[SOLVED] Why does my PHP code give the wrong date?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
2kau
Forum Newbie
Posts: 1
Joined: Mon Jun 28, 2004 11:51 am

Why does my PHP code give the wrong date?

Post by 2kau »

I have:

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

It gives:

June 9, 2004

Why? Today is the 28th?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]date[/php_man] wrote:g - 12-hour format of an hour without leading zeros
I think you want 'd'
User avatar
dull1554
Forum Regular
Posts: 680
Joined: Sat Nov 22, 2003 11:26 am
Location: 42:21:35.359N, 76:02:20.688W

Post by dull1554 »

eother that or it may be that your php server is in another time zone.....
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

but hes talking about date not time
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

its a possiblity that the server time he WAY off!
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post 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.
Post Reply