开发者

PHP date() getting wrong time

开发者 https://www.devze.com 2023-01-31 06:18 出处:网络
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:

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消