当前位置: 动力学知识库 > 问答 > 编程问答 >

php - How to convert from CST to PST?

问题描述:

How to convert this date

2010-05-25 04:55:01 CST (America/Chicago)

to PST (America/Los_Angeles) timezone?

网友答案:

Something like that (change the output format to suit your needs):

<?php
       $dte = new DateTime('2010-05-25 04:55:01', 
                  new DateTimeZone('America/Chicago'));
       $dte->setTimeZone(new DateTimeZone('America/Los_Angeles'));
       echo $dte->format(DateTime::COOKIE);
?>

Outputs:

Tuesday, 25-May-10 02:55:01 PDT

分享给朋友:
您可能感兴趣的文章:
随机阅读: