getdate and date

From: Joost Wilbrink (joost_at_wilbrink.ws)
Date: 02/25/05


Date: Fri, 25 Feb 2005 11:34:54 +0100

Hello,

I have discovered something strange on my server related to gmt timestamp
handling in php.
When I take a gmt timestamp with:

$gmt_timestamp = gmmktime();
print date("h:i", $gmt_timestamp);

It prints the gmt time correctly (the server is located gmt -6 timezone)

But when I do:

$timearray = getdate($gmt_timestamp);
print_r($timearray);

It gives me the gmt time 12 hours back, for example when the gmt time is
10:30 am, then it gives me 22:30 and also the date of the previous day :-s

Can someone helps me what the possible cause of this can be?

Thanks
Best regards
Joost



Relevant Pages

  • Re: php to get date and time separately into MySQL?
    ... I would agree that while your question IS a PHP question, the solution may be a MySQL solution. ... If your database has a DATETIME and TIMESTAMP column you could use the MySQL function NOWor the PHP timeboth of which derive the "unix timestamp" which is number of seconds from EPOCH time for that platform. ...
    (comp.lang.php)
  • Re: php to get date and time separately into MySQL?
    ... I would agree that while your question IS a PHP question, the solution may be a MySQL solution. ... If your database has a DATETIME and TIMESTAMP column you could use the MySQL function NOWor the PHP timeboth of which derive the "unix timestamp" which is number of seconds from EPOCH time for that platform. ...
    (comp.lang.php)
  • Re: php to get date and time separately into MySQL?
    ... I would agree that while your question IS a PHP question, ... may be a MySQL solution. ... database has a DATETIME and TIMESTAMP column you could use the MySQL ...
    (comp.lang.php)
  • Re: displaying pre-1970 dates
    ... I'm using PHP 4.3.8. ... string date (string format [, int timestamp]) ...
    (comp.lang.php)
  • Re: [PHP] Framed & Linked Content
    ... PHP can echo the JavaScript that facilitates the break out. ... using a combination of the document ID, a timestamp, and salt, and md5 ... the encoding that validates the passed ID and timestamp. ... //display some random picture of a guy flipping you the bird and echo ...
    (php.general)