00 案例的 strtotime
strtotime for 00 case
我用 00.30pm 值回显当前日期的 strtotime 值,但它给了我空白结果。谁能指导我为什么它不显示价值。或者有什么方法可以获取
的值
echo strtotime('03/23/2017 00:30am');
你的格式有误。
正确的是
echo strtotime('03/23/2017 00:30');
或
echo strtotime('03/23/2017 12:30am');
希望它会起作用:
格式:Reference
echo strtotime('03/23/2017 00:30a.m.');
请用以下代码检查
$dateString = "03/23/2017 00:30am";
$myDateTime = DateTime::createFromFormat('m/d/Y h:ia', $dateString);
$newDateString = $myDateTime->format('Y-m-d H:i:s');
echo $loc_strto_time = strtotime($newDateString);
试试这个,它会解决你的问题。您在 strtotime 内附加 am,这就是为什么它不恢复任何内容的原因。
echo date("jS F, Y h:i:s A", strtotime("03/23/2017 00:30"));
我用 00.30pm 值回显当前日期的 strtotime 值,但它给了我空白结果。谁能指导我为什么它不显示价值。或者有什么方法可以获取
的值echo strtotime('03/23/2017 00:30am');
你的格式有误。
正确的是
echo strtotime('03/23/2017 00:30');
或
echo strtotime('03/23/2017 12:30am');
希望它会起作用:
格式:Reference
echo strtotime('03/23/2017 00:30a.m.');
请用以下代码检查
$dateString = "03/23/2017 00:30am";
$myDateTime = DateTime::createFromFormat('m/d/Y h:ia', $dateString);
$newDateString = $myDateTime->format('Y-m-d H:i:s');
echo $loc_strto_time = strtotime($newDateString);
试试这个,它会解决你的问题。您在 strtotime 内附加 am,这就是为什么它不恢复任何内容的原因。
echo date("jS F, Y h:i:s A", strtotime("03/23/2017 00:30"));