解决方案 »
PHP 时间比较用 UNIX 时间戳 最方便了呀
你取出的时间是什么格式?
你先用个函数转化时间格 统一UNIX时间戳 就能简单的比较大小了
$monDay ='2004/01/02';
$todate ='2004/01/01';
if(strtotime($monDay)>strtotime($todate)){
echo('结束了');
}
建议楼主存储unix时间戳,到时候也不用mktime,直接比较时间戳的大小即可!
$fromdete = "2009-04-20";
$a=explode('-',$fromdete);$c=mktime(0,0,0,$a[1],$a[2],$a[0]);
$b=time();
if($b<$c)
{
echo '对不起,本次比赛活动投稿即将开始,敬请关注';
}
?>
我是都转换成UNIX时间戳在比较
比如if ((strtotime(date("Y-m-d H:i:s")) >= strtotime($v['end_time'])){
。。。
}