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 cor开发者_如何学JAVArect). 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.
Your server's time is likely incorrect. If you have SSH access, running date
will show you what the server is set to.
Is the servers time set properly?
精彩评论