note 89165 deleted from function.date by tularis

From: Date: Thu, 09 Feb 2012 20:58:14 +0000
Subject: note 89165 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-185994@lists.php.net to get a copy of this message
Note Submitter: pierre ---- It seems to me that you can reliably get the week range of a certain numeric week like so: <?php // 2009 is the year // W01 is week number 1 // 1 is the day number (Monday), 7 would be Sunday strtotime("2009W011"); // Example 1 (These return the days for Week 1 or 2009 Mon_timestamp = strtotime("2009W011"); Tue_timestamp = strtotime("2009W012"); Wed_timestamp = strtotime("2009W013"); Thu_timestamp = strtotime("2009W014"); Fri_timestamp = strtotime("2009W015"); Sat_timestamp = strtotime("2009W016"); Sun_timestamp = strtotime("2009W017"); // Example 2 (more dynamic) // set the 7 dates of the week for($i=1; $i<=7; $i++) { $dates[$i] = strtotime($year.'W'.$week.$i); } ?> Just remember you must pad the week number if it's under 10. 1 won't work, it should be 01.

« previous php.notes (#185994) next »