php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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
Description:
------------
According to documentation (http://php.net/manual/en/function.date.php):

"
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:
---------------
<?php
echo date('l'), " ", date('w'), " ", date('N');

Expected result:
----------------
Tuesday 1 2

Actual result:
--------------
Tuesday 2 2

Patches

Pull Requests

History

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

The only difference is that for Sunday it's 0 in the first case and 7 in the 
second.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 16:01:30 2025 UTC