php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #74926 jddayofweek should mention it's about Julian days
Submitted: 2017-07-14 18:51 UTC Modified: 2018-01-29 23:10 UTC
From: steve at steverumberg dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: Linux
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: steve at steverumberg dot com
New email:
PHP Version: OS:

 

 [2017-07-14 18:51 UTC] steve at steverumberg dot com
Description:
------------
On this page: http://php.net/manual/en/function.jddayofweek.php

in the explanation of "Parameters"

it says:  "Return the day number as an int (0=Sunday, 1=Monday, etc)"

I read this as "1" represents "Monday"
When I use the numeral 1 in the function, I don't get MONDAY, I get TUESDAY.

(Though I'm using an older version [PHP 5.3 on Godaddy shared server], the doc does not indicate any changes based on the version.)

Thank you

Test script:
---------------
echo jddayofweek(1, 1);

Expected result:
----------------
MONDAY

Actual result:
--------------
TUESDAY

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-14 19:25 UTC] requinix@php.net
-Summary: jddayofweek +Summary: jddayofweek should mention it's about Julian days -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Package: Documentation problem +Package: Date/time related
 [2017-07-14 19:25 UTC] requinix@php.net
Er, no. The function tells you the day number ($mode=0), day name ($mode=1), or abbreviated day name ($mode=2) for a given Julian day ($julianday).
https://en.wikipedia.org/wiki/Julian_day

Julian day 1 was a few thousand years ago, which PHP calculates to be a Tuesday. Of course that predates recorded history, not to mention happened way before the 7-day week was invented by the Romans, which itself was more than a millennium before the Gregorian calendar was created during the early modern period (and don't get me started on its actual adoption timeline spanning the subsequent few centuries), so whether the day was truly a "Tuesday" is pointlessly debatable...

*ahem* So the function is working correctly. The docs do a decent job of hinting that this function is about Julian days, but actually stating that is certainly not out of the question.
Meanwhile the docs for the other jd* functions look fine to me.
 [2018-01-29 23:10 UTC] vrana@php.net
-Status: Verified +Status: Not a bug
 [2018-01-29 23:10 UTC] vrana@php.net
It seems clear.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 17:01:28 2024 UTC