例子:
try {
$date = new DateTime('2000-01-01');
} catch (Exception $e) {
echo $e->getMessage();
exit(1);
}
echo $date->format("Y-m-d h:i:sa");为什么输出时间时却显示12:00:00?
不是应该显示00:00:00的吗?
try {
$date = new DateTime('2000-01-01');
} catch (Exception $e) {
echo $e->getMessage();
exit(1);
}
echo $date->format("Y-m-d h:i:sa");为什么输出时间时却显示12:00:00?
不是应该显示00:00:00的吗?
$date = new DateTime('2000-01-01', new DateTimeZone("PRC"));
echo $date->format('Y-m-d H:i:s');
?>你起码这样做才是合理的,你的代码其实应该是会挂在new那里,不知道为什么你没有出错。