note 18690 deleted from function.strtotime by vincent
| From: | vincent@php.net | Date: | Thu, 11 Sep 2003 19:41:02 +0000 |
| Subject: | note 18690 deleted from function.strtotime by vincent | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56170@lists.php.net to get a copy of this message | ||
Note Submitter: pascal.thomas@magic.fr
----
// support date format as : 23 1 2003, 23-01-2003, 23/01/2003,
// return timestamp
function str2date($in){
$t = split("/",$in);
if (count($t)!=3) $t = split("-",$in);
if (count($t)!=3) $t = split(" ",$in);
if (count($t)!=3) return -1;
if (!is_numeric($t[0])) return -1;
if (!is_numeric($t[1])) return -2;
if (!is_numeric($t[2])) return -3;
if ($t[2]<1902 || $t[2]>2037) return -3;
return mktime (0,0,0, $t[1], $t[0], $t[2]);
}