php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6345 wrong days in december of 2000
Submitted: 2000-08-25 04:27 UTC Modified: 2000-09-21 10:20 UTC
From: hydrix at earthlink dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: Windows 98
Private report: No CVE-ID: None
 [2000-08-25 04:27 UTC] hydrix at earthlink dot net
I've found a bug doing some calendar scripts. For example 
$blah = getdate(977893200);
echo $blah[mday]; (the unix timestamp is a december 200 ts)
shows only 30 days for december. No wonder I have been getting so many headaches! Yall need to fix this little bug. :)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-27 05:56 UTC] stas@php.net
977893200 is a timestamp for Decemer 27. And as far as I see when using right timestamp it gets right results.
 [2000-08-27 16:14 UTC] hydrix at earthlink dot net
aren't there 31 days in december? when doing the getdate and trying to display 31 days in december, I only get 30 days in december while trying to do the example I tried below instead of getting 31 days.
 [2000-08-27 16:45 UTC] hholzgra@php.net
which "example below", can't see any ... ?
 [2000-08-27 17:34 UTC] rasmus@php.net
Your timestamp in your example is for December 26 (PST).
Try this:
    $blah = getdate(978282000);
    echo $blah[mday];
This prints 31 for me.  It will of course depend on your timezone.  To really test it, try this:
    $t = mktime(10,0,0,12,31,2000);
    $blah = getdate($t);
    echo $blah[mday];
This figures out the timestamp for 10 AM Dec.31 in your local timezone and then verifies that getdate() does indeed return 31.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 10:00:02 2026 UTC