php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43738 strftime outputs wrong week decimal
Submitted: 2008-01-03 16:10 UTC Modified: 2008-01-03 16:20 UTC
From: timon at xploreweb dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.5 OS: RHEL 4ES, WinXP SP2
Private report: No CVE-ID: None
 [2008-01-03 16:10 UTC] timon at xploreweb dot com
Description:
------------
strftime outputs wrong week number, 00 instead of 01.

Used date("W", "1199314800"); as work around, which is correct.

Reproduce code:
---------------
<?php

date("F j, Y, g:i a", "1199314800");
// output: January 3, 2008, 12:00 am

strftime("%W", "1199314800");
// output: 00

?>

Expected result:
----------------
Week number should be 01 and not 00. Also the weeks after in 2008 the week numbers should be minus 1.

Actual result:
--------------
Counting starts at 00 instead of 01

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-03 16:20 UTC] scottmac@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

" %W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week"

The first Monday in the year is the 7th.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 20 00:00:02 2025 UTC