php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40116 using gregorian to jeulian to unix timestamp in date is wonky
Submitted: 2007-01-13 03:59 UTC Modified: 2007-01-13 16:58 UTC
From: marsh dot wayne at gmail dot com Assigned:
Status: Not a bug Package: Calendar related
PHP Version: 5.2.0 OS: Windows 2000 SP4
Private report: No CVE-ID: None
 [2007-01-13 03:59 UTC] marsh dot wayne at gmail dot com
Description:
------------
I do believe this issue is with date.  None of the bugs that appeared seemed to say the issue was resolved.  I will install latest cvs and see if that resolves the issue and then update the bug issue.

Reproduce code:
---------------
<?php
error_reporting(E_ALL);
for($x = 1; $x < 13; $x++ ){
echo date("F", jdtounix(GregorianToJD( $x, 1 ,2008 )))." - ".$x."<br />";
}
?>

Expected result:
----------------
January - 1
February - 2
March - 3
April - 4
May - 5
June - 6
July - 7
August - 8
September - 9
October - 10
November - 11
December - 12

Actual result:
--------------
December - 1
January - 2
February - 3
March - 4
April - 5
May - 6
June - 7
July - 8
August - 9
September - 10
October - 11
November - 12

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-13 16:45 UTC] marsh dot wayne at gmail dot com
Seems to be an issue on how the functions return the timestamp.  I don't think this is the issue as it takes up to 15 days, and not the difference of GMT vs local time, to make the proper month output.
 [2007-01-13 16:52 UTC] iliaa@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

You need to add date_default_timezone_set('UTC'); to your 
code. Otherwise the timezone changes jan 1 to Dec 31.
 [2007-01-13 16:58 UTC] marsh dot wayne at gmail dot com
Thanks, I spent a few hours trying to figure this out...  Someone already told me it's not a bug.

I did try changing the day to the 15th and that didn't make a difference.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC