0
如何從此時間偏移中獲取「UTC,PST,EST等..」名稱? 你可以複製/粘貼這個任何PHP文件,它會運行。時間戳YYYY-MM-DDTHH:MM:SS + 00:00
<?php
date_default_timezone_set('UTC');
$time = '2012-01-01T21:15:00+00:00';
echo '<pre>';
echo "<b>Step 1 (Have the date now)</b>\n";
$time = explode('T', $time);
print_r($time);
echo "\n\n<b>Step 2 (Get the offset)</b>\n";
$offset = explode('+', $time[1]);
$time[1] = $offset[0];
print_r($offset);
echo "\n\n";
echo date('l F jS', strtotime($time[0])) . ', at ' . date('g:ia', strtotime($time[1]));
echo "\n\n";
//
// How do I matchup the offset in this list?
// The values are -18000, -7200
//
$b = timezone_abbreviations_list();
print_r($b);
注:我使用echo date('c', $time);
也試過,但也許我有什麼不對的給我一個錯誤。