Doc #63930 [Opn->Ver]: cal_from_jd['dow'] gives 0 for Sunday
| From: | cmb@php.net | Date: | Mon, 04 Sep 2017 11:33:18 +0000 |
| Subject: | Doc #63930 [Opn->Ver]: cal_from_jd['dow'] gives 0 for Sunday | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-14949@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63930&edit=1
ID: 63930
Updated by: cmb@php.net
Reported by: r07271368 at hotmail dot com
Summary: cal_from_jd['dow'] gives 0 for Sunday
-Status: Open
+Status: Verified
Type: Documentation Problem
Package: Calendar related
Operating System: testbed at tehplayground.com
PHP Version: Irrelevant
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2013-01-07 10:28:23] 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
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63930&edit=1