gmdate() - want 1 hr before time


Posted on 16th Feb 2014 07:03 pm by admin

Hi,
I am using php gmdate().
Now I am entering all dates in my dbase using gmdate("Y-m-d H:i:s")
I want 1 hr before datetime.
Did you know?Explore Trending and Topic pages for more stories like this.
So am using like
gmdate("Y-m-d H:i:s", mktime(gmdate("H")-$hrs, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d"), gmdate("Y")));
where $hr = 1
When I echo current date i,e

$date = gmdate('Y-m-d H:i:s');
echo "<br/>current date is $date";

its
2009-12-27 03:54:08

and when echo my code of getting 1 hr before
$date1 = gmdate("Y-m-d H:i:s", mktime(gmdate("H")-1, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d"), gmdate("Y")));

its
2009-12-26 02:54:08

difference between these 2 days is 1 day and not 1 hr.
I want 1 hr before datetime to be
2009-12-27 02:54:08

Can please anybody help.
Thanks in advance
No comments posted yet

Your Answer:

Login to answer
283 Like 54 Dislike
Previous forums Next forums
Other forums

str_replace help
Hey there,

I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean

check_changed_data - I can't get data from the called method event
I use check_changed_data to trigger my event method.

The method delivers er_changed_data.

Weird MySQL error, why am I recieving this?
PHP Code:


<?php require "global_settings.php"; ?>
<titl

[function.file]: failed to open stream: No such file or directory
Okay I wrote this little script to upload a csv file that is located on my webhosts server to a mysq

Does design fit in FPGA ?
Hi all,

I've made a large HCC-Design. Because of the program-size the compile process with th

VAT
how should I deal with VAT?

if I have a product that costs £5.00 and VAT @ 17.5% (£0.87

calendar dates and hours compare problem
i have a calendar in wordpress, everything works great except that i can make 2 meetings at the same

INSERT data problem!
After having an string with apostrophes ', double quotes " or any other special characters, suc

onClick='location.href=index.htm'> not working
Below is my code:

echo "<input type='button' value='redirect' onClick='location.h

User information
Hi All,
By using t-code SUIM we get all the user details,if suppose we donot have permission t

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash