You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
622 B
23 lines
622 B
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Administrator
|
|
* Date: 15-5-14
|
|
* Time: 上午9:36
|
|
*/
|
|
class LangUtils
|
|
{
|
|
private static $REGEX = '/^(?:(?!0000)[0-9]{4}(?:(?:0[1-9]|1[0-2])(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])(?:29|30)|(?:0[13578]|1[02])31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)0229)$/i';
|
|
public static function validateDate($date)
|
|
{
|
|
if($date == null)
|
|
{
|
|
return false;
|
|
}
|
|
if(!preg_match(LangUtils::$REGEX,$date))
|
|
{
|
|
return false;
|
|
}
|
|
return strtotime($date) < time();
|
|
}
|
|
} |