#50105 [NEW]: strtotime, strftime, weekday & monday & year leap
by Tcheko At No-Log Dot Org other posts by this author
Nov 6 2009 1:12PM messages near this date
#50106 [Opn->Bgs]: htmlspecialchars is inconsistent with the specification
|
#50105 [Opn->Bgs]: strtotime, strftime, weekday & monday & year leap
From: tcheko at no-log dot org
Operating system: Linux
PHP version: 5.3.0
PHP Bug Type: Date/time related
Bug description: strtotime, strftime, weekday & monday & year leap
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
--
Edit bug report at http://bugs.php.net/?id=50105&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50105&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50105&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50105&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50105&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50105&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50105&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50105&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50105&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50105&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50105&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50105&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50105&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50105&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50105&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50105&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50105&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50105&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50105&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50105&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50105&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50105&r=mysqlcfg
Thread:
Tcheko At No-Log Dot Org
derick
|