Doc #63930 [NEW]: cal_from_jd['dow'] gives 0 for Sunday
| From: | r07271368 at hotmail dot com | Date: | Mon, 07 Jan 2013 10:28:23 +0000 |
| Subject: | Doc #63930 [NEW]: cal_from_jd['dow'] gives 0 for Sunday | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-9361@lists.php.net to get a copy of this message | ||
From: r07271368 at hotmail dot com
Operating system: testbed at tehplayground.com
PHP version: Irrelevant
Package: Calendar related
Bug Type: Documentation Problem
Bug description:cal_from_jd['dow'] gives 0 for Sunday
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 bug report at https://bugs.php.net/bug.php?id=63930&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63930&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63930&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63930&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=63930&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=63930&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63930&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=63930&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=63930&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=63930&r=support
Expected behavior: https://bugs.php.net/fix.php?id=63930&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=63930&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=63930&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=63930&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63930&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=63930&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=63930&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=63930&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63930&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63930&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=63930&r=mysqlcfg