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
功能时。我怎样才能做到这一点?
谢谢至少您已回答 –