|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65177 date('w') returns result in range 1-7 instead of 0-6
Submitted: 2013-07-01 21:27 UTC Modified: 2013-07-01 22:08 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: m dot zakarczemny+php at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.4.16 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: m dot zakarczemny+php at gmail dot com
New email:
PHP Version: OS:


 [2013-07-01 21:27 UTC] m dot zakarczemny+php at gmail dot com
According to documentation (

w	Numeric representation of the day of the week	0 (for Sunday) through 6 
(for Saturday)
N	ISO-8601 numeric representation of the day of the week (added in PHP 
5.1.0)	1 (for Monday) through 7 (for Sunday)

but date('w') returns day number in 1-7 range.

Test script:
echo date('l'), " ", date('w'), " ", date('N');

Expected result:
Tuesday 1 2

Actual result:
Tuesday 2 2


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-01 22:08 UTC]
-Status: Open +Status: Not a bug
 [2013-07-01 22:08 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

The only difference is that for Sunday it's 0 in the first case and 7 in the 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 16:01:30 2024 UTC