0
我的代碼如下:PHP EDT/EST時間轉換
<?php
function my_time($zone,$dst){
if ($dst=='on') {
// bellow codes will return time date when DST is on/EDT time
$dateTime = new DateTime('now', new DateTimeZone($zone));
$dst_on = $dateTime->format("d-m-Y h:i A");
return $dst_on;
}elseif ($dst=='off') {
// bellow codes will return time date when DST is off/EST time
$dateTime = new DateTime('now', new DateTimeZone($zone));
$dst_off = $dateTime->format("d-m-Y h:i A");
return $dst_off.' (Wrong output, i need DST off/EST output here! Please help)'; // Please help me to return dst off/EST time here
}
}
echo my_time('America/New_York','off');
?>
我想正確的輸出傳遞off
參數my_time
功能時。我怎樣才能做到這一點?
謝謝至少您已回答 –