php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63930 cal_from_jd['dow'] gives 0 for Sunday
Submitted: 2013-01-07 10:28 UTC Modified: 2018-03-01 12:26 UTC
From: r07271368 at hotmail dot com Assigned: cmb (profile)
Status: Closed Package: Calendar related
PHP Version: Irrelevant OS: testbed at tehplayground.com
Private report: No CVE-ID: None
 [2013-01-07 10:28 UTC] r07271368 at hotmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.cal-from-jd#refsect1-function.cal-from-jd-returnvalues
---

The documentation for cal_to_jd fails to state the range of values for element 'dow' of the output array.

It appears that the values range from 0 to 6, with 0 meaning Sunday.


Test script:
---------------
echo "Result for Saturday, January 1, 2000:"
$d = cal_to_jd(CAL_GREGORIAN, 1, 1, 2000);
print_r(cal_from_jd($d, CAL_GREGORIAN));
echo "\n\n";
echo "Result for Sunday, January 2, 2000:"
$d = cal_to_jd(CAL_GREGORIAN, 1, 2, 2000);
print_r(cal_from_jd($d, CAL_GREGORIAN));

Expected result:
----------------
Array
(
    [date] => 1/1/2000
    [month] => 1
    [day] => 1
    [year] => 2000
    [dow] => 6
    [abbrevdayname] => Sat
    [dayname] => Saturday
    [abbrevmonth] => Jan
    [monthname] => January
)


Array
(
    [date] => 1/2/2000
    [month] => 1
    [day] => 2
    [year] => 2000
    [dow] => 7
    [abbrevdayname] => Sun
    [dayname] => Sunday
    [abbrevmonth] => Jan
    [monthname] => January
)

Actual result:
--------------
Array
(
    [date] => 1/1/2000
    [month] => 1
    [day] => 1
    [year] => 2000
    [dow] => 6
    [abbrevdayname] => Sat
    [dayname] => Saturday
    [abbrevmonth] => Jan
    [monthname] => January
)


Array
(
    [date] => 1/2/2000
    [month] => 1
    [day] => 2
    [year] => 2000
    [dow] => 0
    [abbrevdayname] => Sun
    [dayname] => Sunday
    [abbrevmonth] => Jan
    [monthname] => January
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-04 11:33 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2018-03-01 12:26 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=344407
Log: Fix bug #63930: cal_from_jd['dow'] gives 0 for Sunday
 [2018-03-01 12:26 UTC] cmb@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cmb
 [2018-03-01 12:26 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
 [2020-02-07 06:05 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=ce74b736cf005887bd02330ee477a3b9faa7894b
Log: Fix bug #63930: cal_from_jd['dow'] gives 0 for Sunday
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jun 18 06:01:31 2024 UTC