Go to the source code of this file.
Functions | |
isValidDate ($date_) | |
Returns true if the input variable is a valid date or datetime. | |
isValidTime ($time_) | |
Returns true if the input variable is a valid time. |
Definition in file Date.php.
isValidDate | ( | $ | date_ | ) |
Returns true if the input variable is a valid date or datetime.
isValidDate('2006-01-01'); isValidDate("2006-01-01 21:02:02")')); isValidDate("now")')); isValidDate("12jan2009")'));
$date_ | - dateTime - The date to validate. |
Definition at line 25 of file Date.php.
Referenced by UrlRequst::getDateTime().
00026 { 00027 $time = strtotime($date_); 00028 if ($time === false) 00029 { 00030 return false; 00031 } 00032 00033 return true; 00034 }
isValidTime | ( | $ | time_ | ) |
Returns true if the input variable is a valid time.
isValidTime('21:02:00');
$time_ | - string - |
Definition at line 47 of file Date.php.
00048 { 00049 $matches = NULL; 00050 preg_match('/^([\d]{1,2})[:]{1}([\d]{2})[:]{1}([\d]{2})$/', $time_, $matches); 00051 00052 if 00053 ( 00054 empty($matches) || 00055 $matches[1] < 0 || 00056 $matches[1] >= 24 || 00057 $matches[2] < 0 || 00058 $matches[2] >= 60 || 00059 $matches[3] < 0 || 00060 $matches[3] >= 60 00061 ) 00062 { 00063 return false; 00064 } 00065 else 00066 { 00067 return true; 00068 } 00069 }