Zera42
Zera42

Reputation: 2692

PHP date function returning wrong date, how can I specify my time zone?

<?php echo date('m/d/Y',time());?>

echos

07/13/2013

when it should echo

07/12/2013

Is there a server config I should change and if there is where could I find it? Thank you My time zone is (UTC-08:00) Pacific Time (US & Canada)

Upvotes: 1

Views: 7843

Answers (1)

jh314
jh314

Reputation: 27812

Check out date_default_timezone_set:

Example:

date_default_timezone_set('America/Los_Angeles');

Upvotes: 6

Related Questions