php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7640 problem with weeknumbers
Submitted: 2000-11-04 17:59 UTC Modified: 2000-11-05 00:23 UTC
From: jesper at barra dot se Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.0.3pl1 OS: Linux
Private report: No CVE-ID: None
 [2000-11-04 17:59 UTC] jesper at barra dot se
print strftime("%V",mktime(0,0,0,12,31,1999));
# prints weeknumber 52
print strftime("%V",mktime(0,0,0,01,01,2000));
# prints weeknumber 53

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-04 20:16 UTC] rasmus@php.net
That is expected behaviour.  Please read the manual: http://www.php.net/manual/function.strftime.php

%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
 [2000-11-04 23:52 UTC] jah@php.net
A small correction. This *isn't* the expected result. Or at least, with my understanding of the actual definition of %V.
They should both be 52.

But keeping closed anyway, this is not a PHP related bug.
PHP just calls the systems c-library function strftime and
passes the result back. Nothing to fix unless we roll up our
own version (in which case there could be too much to
fix...).
 [2000-11-05 00:23 UTC] rasmus@php.net
True.  And on my Linux the specific example returns 52 and 52.  
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC