note 107269 deleted from function.strptime by danbrown
| From: | danbrown@php.net | Date: | Thu, 10 May 2012 21:32:57 +0000 |
| Subject: | note 107269 deleted from function.strptime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-187905@lists.php.net to get a copy of this message | ||
Note Submitter: dice.the.hacker at gmail dot com
----
Faster then using regexp's strptime function implementation for Windows
function strptime($date, $format){
$format=str_replace('%','',$format);
$res = date_parse_from_format($format,$date);
if($res['error_count']) return false;
return array(
"tm_sec" => (int) $res['second'],
"tm_min" => (int) $res['minute'],
"tm_hour" => (int) $res['hour'],
"tm_mday" => (int) $res['day'],
"tm_mon" => (int) $res['month'],
"tm_year" => (int) $res['year'],
);
}