how can i 开发者_StackOverflow中文版display diffrent timezones time in a page with php?
like
Eastern: 02:23 AM
Central: 02:23 AM
Asia/India: 02:23 AM
Mountain: 02:23 AM
Pacific: 02:23 AM
foreach (DateTimeZone::listIdentifiers() as $timezone)
{
$time = new DateTime('now', new DateTimeZone($timezone));
echo $timezone . ': ' . $time->format('c').'<br>';
}
You can do something like this:
$date = new DateTime("now", new DateTimeZone('Europe/London'));
$tz = $date->getTimezone();
echo $tz->getName() . " - " . $date->format('H:m');
精彩评论