note 71600 added to function.strptime

From: Date: Thu, 07 Dec 2006 11:28:48 +0000
Subject: note 71600 added to function.strptime
Groups: php.notes 
Request: Send a blank email to php-notes+get-120367@lists.php.net to get a copy of this message
WARNING ! BUG ! strptime( '%m' ) returns 00-11, but by documentation 01-12 !!! So, ISO-8601=>UNIX for example looks like follows: NB: "$tm['tm_mon'] + 1" in mktime() call ! <? function iso2unix( $strdate ) { $tm = strptime( $strdate, '%Y-%m-%dT%T' ); return mktime( $tm['tm_hour'], $tm['tm_min'], $tm['tm_sec'], $tm['tm_mon'] + 1, $tm['tm_mday'], $tm['tm_year'] ); } $start = getdate( iso2unix( '2006-12-07T13:23:07.103' ) ); var_dump( $start ); // result array(11) { "seconds"=> 7, "minutes"=> 23, "hours"=> 13, "mday"=> 7, "wday"=> 4, "mon"=> 12, "year"=> 2006, "yday"=> 340, "weekday"=> "Thursday", "month"=> "December", 0=> 1165486987 } ?> ---- Server IP: 195.222.164.18 Probable Submitter: 213.148.160.88 ---- Manual Page -- http://www.php.net/manual/en/function.strptime.php Edit -- https://master.php.net/note/edit/71600 Del: integrated -- https://master.php.net/note/delete/71600/integrated Del: useless -- https://master.php.net/note/delete/71600/useless Del: bad code -- https://master.php.net/note/delete/71600/bad+code Del: spam -- https://master.php.net/note/delete/71600/spam Del: non-english -- https://master.php.net/note/delete/71600/non-english Del: in docs -- https://master.php.net/note/delete/71600/in+docs Del: other reasons-- https://master.php.net/note/delete/71600 Reject -- https://master.php.net/note/reject/71600 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#120367) next »