PHP的日期比较大小函数方法
- Posted By:访客(58.215.235.30) At 2012-03-21 17:19:59
- function specialinfo_form_validate($form,&$form_state)
{
$startdate=$form_state['values']['s_startdate'];
$enddate=$form_state['values']['s_enddate'];
if(date("Y-m-d",strtotime($startdate))<date("Y-m-d",time()))
{
form_set_error($startdate,t('the Start date not small and the current date !'));
}
if(date("Y-m-d",strtotime($startdate))>date("Y-m-d",strtotime($enddate)))
{
form_set_error($enddate,t('the end date beyond the start date !'));
}
}
感谢楼主的精彩代码!谢谢!
PHP的日期比较大小函数方法
- Posted By:admin At 2012-02-10 15:14:24
- $date2="2007-1-20";
$date="2006-1-1";
if (strtotime($date2)>strtotime($date)){
echo 'Y';
}else{
echo 'N';
}
1 [2] [3] [4] [5] [6] [7] [8] [9] [10] > >>
|
|