get server time in php - timezone issues

前端 未结 4 1453
攒了一身酷
攒了一身酷 2020-12-13 20:41

on shell, my server time is (simple date in bash): Sun Aug 29 10:37:12 EDT 2010

when I run the code php -r \"echo date(\'Y-m-d H:i:s\');\"

4条回答
  •  天命终不由人
    2020-12-13 21:38

    Late for the party, but if you want to set the timezone without edit php.ini, you can put in the php code one of these strings:

    date_default_timezone_set('GMT');
    date_default_timezone_set('Europe/Zurich');
    date_default_timezone_set('America/New_York');
    

提交回复
热议问题