note 47094 deleted from function.date by tularis
| From: | tularis@php.net | Date: | Sun, 30 Jan 2005 14:42:37 +0000 |
| Subject: | note 47094 deleted from function.date by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-84240@lists.php.net to get a copy of this message | ||
Note Submitter: tbellefy at yahoo dot com
----
In Reply to "post at penest dot no"
"post at penest dot no" wrote:
I needed to change the time to the correct local time for inserting it with now() in a mysql update
query.
I too have that problem. My server and my local time is -8 from GMT.....Hmmm....
Displayed without local time:
<?php
echo date("l dS of F Y H:i:s A");
// Returns: Tuesday 02nd of November 2004 16:42:40 PM
// This is wrong. 8 hours off.
?>
That displays GMT though.... I need my local time! So here goes:
<?php
// I am -8 hours from GMT:
$now = mktime(date("H")-8, date("i"), date("s"), date("m"),
date("d"), date("Y"));
echo date("l dS of F Y H:i:s A",$now);
// Returns: Tuesday 02nd of November 2004 08:42:40 AM
// This is correct!
?>
Hope this helps...