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

Save User Inputs while javascript reloading!
hi..
i have written a PHP code in which i reload the page when user selects a value in dropdown..

getting most records by count
Code: [Select]<?php

$connect = mysql_connect("localhost","dam

Executing an exe
Hi. I have some bizarre problem with exec (other any other method) to launch exe's. I am making a ga

Undefined variables
hi
----------------------------------------------------------------------------------------------

Fetching META TAGS through
Hello everybody
I want to fetch meta tags of a domain.
It will be done from following code of

How can I uploading Transactional Data from Legacy to New SAP system
Hell Gurus,

I am overwhelmed with questions on how to migrate huge volume of Sales Orders

Image loading
Hi Developers,

I'm trying to display an image from images/image.gif getting the url from mysq

php title problem
Hi,

I am having a problem managing my page title with PHP.

Currently I have my <

MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
We have SAP XMII 12.0 setup running on Netweaver 2004s,7.0, Java Stack only.

Perplexing problem showing a .jpg
Please disregard..........I figured it out

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