note 92756 added to function.strtotime

From: Date: Fri, 07 Aug 2009 13:35:57 +0000
Subject: note 92756 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-159184@lists.php.net to get a copy of this message
strtotime() also returns time by year and weeknumber. (I use PHP 5.2.8, PHP 4 does not support it.) Queries can be in two forms: - "yyyyWww", where yyyy is 4-digit year, W is literal and ww is 2-digit weeknumber. Returns timestamp for first day of week (for me Monday) - "yyyy-Www-d", where yyyy is 4-digit year, W is literal, ww is 2-digit weeknumber and dd is day of week (1 for Monday, 7 for Sunday) <? // Get timestamp of 32nd week in 2009. strtotime('2009W32'); // returns timestamp for Mon, 03 Aug 2009 00:00:00 // Weeknumbers < 10 must be padded with zero: strtotime('2009W01'); // returns timestamp for Mon, 29 Dec 2008 00:00:00 // strtotime('2009W1'); // error! returns false // See timestamp for Tuesday in 5th week of 2008 strtotime('2008-W05-2'); // returns timestamp for Tue, 29 Jan 2008 00:00:00 ?> Weeknumbers are (probably) computed according to ISO-8601 specification, so doing date('W') on given timestamps should return passed weeknumber. ---- Server IP: 92.48.74.199 Probable Submitter: 193.111.24.181 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- https://master.php.net/note/edit/92756 Del: integrated -- https://master.php.net/note/delete/92756/integrated Del: useless -- https://master.php.net/note/delete/92756/useless Del: bad code -- https://master.php.net/note/delete/92756/bad+code Del: spam -- https://master.php.net/note/delete/92756/spam Del: non-english -- https://master.php.net/note/delete/92756/non-english Del: in docs -- https://master.php.net/note/delete/92756/in+docs Del: other reasons-- https://master.php.net/note/delete/92756 Reject -- https://master.php.net/note/reject/92756 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#159184) next »