【发布时间】:2018-01-10 19:45:55
【问题描述】:
在我的代码中,我有这样的场景:
<?php
$start = "03:00:00:am";
$end = "08:00:00:pm";
if($start > $end) {}
?>
我尝试使用 unix 时间戳,但没有成功。
【问题讨论】:
标签: php
在我的代码中,我有这样的场景:
<?php
$start = "03:00:00:am";
$end = "08:00:00:pm";
if($start > $end) {}
?>
我尝试使用 unix 时间戳,但没有成功。
【问题讨论】:
标签: php
试试这个,我不认为最后的 am, pm 是正确的格式,但是你应该可以用这种方式测试它们:
$start = strtotime("03:00:00");
$end = strtotime("20:00:00");
if($start > $end) {}
【讨论】:
使用此代码:
<?php
$start = strtotime("03:00:00");
$end = strtotime("20:00:00");
if($start > $end) {
echo "Yes";
}
else{
echo "No";
}
?>
【讨论】: