我的日期格式为:2016 年 1 月 21 日我想检查它是否在过去 PHP 中。我该怎么做?
使用 strtotime()
:
if(strtotime($date)<strtotime("today")){
echo "past";
} elseif(strtotime($date)==strtotime("today")){
echo "today";
} else {
echo "future";
}
我的日期格式为:2016 年 1 月 21 日我想检查它是否在过去 PHP 中。我该怎么做?
使用 strtotime()
:
if(strtotime($date)<strtotime("today")){
echo "past";
} elseif(strtotime($date)==strtotime("today")){
echo "today";
} else {
echo "future";
}