note 103598 added to function.strptime
| From: | 131 at osu1 dot php dot net | Date: | Thu, 21 Apr 2011 19:17:42 +0000 |
| Subject: | note 103598 added to function.strptime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179061@lists.php.net to get a copy of this message | ||
Another portage for windows (from ex/yks toolkit)
<?php
// public static
function strptime($date, $format) {
$masks = array(
'%d' => '(?P<d>[0-9]{2})',
'%m' => '(?P<m>[0-9]{2})',
'%Y' => '(?P<Y>[0-9]{4})',
'%H' => '(?P<H>[0-9]{2})',
'%M' => '(?P<M>[0-9]{2})',
'%S' => '(?P<S>[0-9]{2})',
// usw..
);
$rexep = "#".strtr(preg_quote($format), $masks)."#";
if(!preg_match($rexep, $date, $out))
return false;
$ret = array(
"tm_sec" => (int) $out['S'],
"tm_min" => (int) $out['M'],
"tm_hour" => (int) $out['H'],
"tm_mday" => (int) $out['d'],
"tm_mon" => $out['m']?$out['m']-1:0,
"tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
);
return $ret;
}
----
Server IP: 69.147.83.197
Probable Submitter: 78.120.29.110
----
Manual Page -- http://www.php.net/manual/en/function.strptime.php
Edit -- https://master.php.net/note/edit/103598
Del: integrated -- https://master.php.net/note/delete/103598/integrated
Del: useless -- https://master.php.net/note/delete/103598/useless
Del: bad code -- https://master.php.net/note/delete/103598/bad+code
Del: spam -- https://master.php.net/note/delete/103598/spam
Del: non-english -- https://master.php.net/note/delete/103598/non-english
Del: in docs -- https://master.php.net/note/delete/103598/in+docs
Del: other reasons-- https://master.php.net/note/delete/103598
Reject -- https://master.php.net/note/reject/103598
Search -- https://master.php.net/manage/user-notes.php