gmdate('F j, Y, g:i a',0) returns January 1, 1970, 12:00 am.
How do I add to the second parameter of the date function to make it
always return that same date, regardless of the time zone?
Intuitively, it seems like date('F j, Y, g:i a',0 - date('Z')) should
do it, but on my system, that's an hour off.
Here's some sample code:
<?
echo gmdate('F j, Y, g:i a',0).'<br />';
echo date('F j, Y, g:i a',0 - date('Z')).'<br />';
echo date('F j, Y, g:i a',0 - date('Z') + 60*60);
?>
And here's the output on my system:
January 1, 1970, 12:00 am
December 31, 1969, 11:00 pm
January 1, 1970, 12:00 am
Will the last echo always return the same thing as the first echo,
regardless of the time zone? If so, why? It seems that the second one
is the one that should do it - not the first one.
How do I add to the second parameter of the date function to make it
always return that same date, regardless of the time zone?
Intuitively, it seems like date('F j, Y, g:i a',0 - date('Z')) should
do it, but on my system, that's an hour off.
Here's some sample code:
<?
echo gmdate('F j, Y, g:i a',0).'<br />';
echo date('F j, Y, g:i a',0 - date('Z')).'<br />';
echo date('F j, Y, g:i a',0 - date('Z') + 60*60);
?>
And here's the output on my system:
January 1, 1970, 12:00 am
December 31, 1969, 11:00 pm
January 1, 1970, 12:00 am
Will the last echo always return the same thing as the first echo,
regardless of the time zone? If so, why? It seems that the second one
is the one that should do it - not the first one.
Comment