vee
vee

Reputation: 353

PHP date() getting wrong time

i'm simply trying to get the current date in PHP, but it's getting '07:45:23' when it's really 11:02am (the date part of it is correct). i am setting the timezone like this:

date_default_timezone_set('America/New_York'); 
$now = date('Y-m-d H:i:s');

why isn't this working? i also tried 'EDT'. and if it matters, the server is also in the same timezone.

thanks.

Upvotes: 0

Views: 2344

Answers (2)

Daniel A. White
Daniel A. White

Reputation: 191048

Is the servers time set properly?

Upvotes: 1

ceejayoz
ceejayoz

Reputation: 180147

Your server's time is likely incorrect. If you have SSH access, running date will show you what the server is set to.

Upvotes: 1

Related Questions