dongya9904 2012-11-28 13:16
浏览 90
已采纳

想要在PHP中将EST转换为PST给定日期

Can we change date which is in EST to PST format...like any PHP function for that

Ex 2012-11-28 08:00:00 which is EST to PST 2012-11-28 05:00:00

I know that we can directly subtract 3 hrs from EST. But is there any PHP in built function which support it ?

  • 写回答

1条回答 默认 最新

  • dongyun65343 2012-11-28 14:53
    关注
    $time = new DateTime($date, new DateTimeZone('America/New_York'));
    $time->setTimezone(new DateTimeZone('America/Los_Angeles'));
    echo $time->format('Y-m-d H:i:s');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?