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.
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

need help about
i store the value of my select statement result to an array and stored it to a variable named $fname

Relative path
I have a absolute path to an image - like so: C:/Program Files/Apache Software Foundation/Apache2.2/

Solution Manager BPR
Does the SolMan-BPR-ARIS-Integration (http://www.ids-scheer.com/en/ARIS/ARIS_Platform/ARIS_Business_

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

How to get the previous months last date....
Here's my wittle problem. I suck at working with dates.

So today is 10/20/2009, i need to fig

Random date selection
i want to select random date with time(hour+minutes+sec) where date is specified(10/22/2009) and tim

Error querying database.
I get the above error when trying to insert some values to a datatable.
Here's the code :

Warning: mysql_num_rows() expects parameter 1
When i add quote at the end of this link
example:http://localhost/articlemania/category.php?cid=3

How to separate records and ORDER BY
Let say i have 100 records and displayed in one page, then i want to get the records from 50-100 and

DateTimeZone::listIdentifiers headache
http://php.net/manual/en/datetimezone.listidentifiers.php


So the documentation states tha

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