Page 1 of 1

Why does my PHP code give the wrong date?

Posted: Mon Jun 28, 2004 11:51 am
by 2kau
I have:

<?php
print date("F g, Y");
?>

It gives:

June 9, 2004

Why? Today is the 28th?

Posted: Mon Jun 28, 2004 12:42 pm
by feyd
[php_man]date[/php_man] wrote:g - 12-hour format of an hour without leading zeros
I think you want 'd'

Posted: Mon Jun 28, 2004 1:00 pm
by dull1554
eother that or it may be that your php server is in another time zone.....

Posted: Mon Jun 28, 2004 1:04 pm
by John Cartwright
but hes talking about date not time

Posted: Mon Jun 28, 2004 1:48 pm
by PrObLeM
its a possiblity that the server time he WAY off!

Posted: Mon Jun 28, 2004 2:34 pm
by redmonkey
What feyd is getting at is....

Code: Select all

print date("F g, Y") . "\x0a";
print date("F d, Y") . "\x0a";
outputs....

Code: Select all

June 7, 2004
June 28, 2004
Given that is is indeed 7 o'clock in my time zone at present and it's also the 28th.