|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-11-06 21:39 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 09:00:02 2026 UTC |
Description: ------------ This code fails on two weeks. Week 1, year printed is 2009 instead of dec 29 2008 and week 52, year printed is 2009 instead of Jan 3 2010. Bug or feature or am I doing something wrong ? Reproduce code: --------------- setlocale(LC_ALL, "fr_FR.utf8"); date_default_timezone_set("Europe/Paris"); // Get the number of weeks in a year $weeks = date("W", mktime(0,0,0,12,31, 2009)); // print the 1st monday of each week with year for($i=1; $i <= $weeks; $i++) { if(strlen($i) == 1) $w = "0" . $i; else $w = $i; echo strftime("%A %e %B %G", strtotime("2009W$w")) . " - " .strftime("%A %e %B %G", strtotime("2009W$w +6days")); } Expected result: ---------------- lundi 28 d?cembre 2008 instead of lundi 28 d?cembre 2009 dimanche 3 janvier 2010 instead of dimanche 3 janvier 2009 Actual result: -------------- Actual code output. Submitted code stripped to revelant part only. Semaine n?1 du lundi 29 d?cembre 2009 au dimanche 4 janvier 2009 Semaine n?53 du lundi 28 d?cembre 2009 au dimanche 3 janvier 2009