如何return一个有效的日期时间格式?
How return a valid datetime format?
小四行代码return空值
<?php
$date = "03-30-15";
$time = "13:00";
$zone = "America/Chicago";
echo "String to time is: " . strtotime("$date $time $zone");
?>
strtotime
无法识别您传递的日期格式。需要采用 Y-m-d
格式:
来自Definition:
The function expects to be given a string containing an English date format
<?php
$date = "2015-03-30";
$time = "13:00";
$zone = "America/Chicago";
echo "String to time is: " . strtotime("$date $time $zone");
?>
DEMO.
小四行代码return空值
<?php
$date = "03-30-15";
$time = "13:00";
$zone = "America/Chicago";
echo "String to time is: " . strtotime("$date $time $zone");
?>
strtotime
无法识别您传递的日期格式。需要采用 Y-m-d
格式:
来自Definition:
The function expects to be given a string containing an English date format
<?php
$date = "2015-03-30";
$time = "13:00";
$zone = "America/Chicago";
echo "String to time is: " . strtotime("$date $time $zone");
?>
DEMO.