I want to get date in another timezone of the date in indian timezone in php. i.e. if the date is 01-02-2013 in indian (+5:30) timezone What is the date in antoher timezone. ?
问问题
175 次
2 回答
1
查看DateTime和DateTimeZone对象。
<?php
$date = new DateTime('now', new DateTimeZone('Europe/London'));
echo $date->format('r e'); // Sun, 14 Apr 2013 10:24:55 +0100 Europe/London
$date->setTimezone(new DateTimeZone('America/New_York'));
echo $date->format('r e'); // Sun, 14 Apr 2013 05:26:08 -0400 America/New_York
于 2013-04-14T09:28:52.043 回答
0
使用date_default_timezone_set
: http: //php.net/manual/en/function.date-default-timezone-set.php
于 2013-04-14T09:14:34.067 回答