php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11212 On the 31.5. the gmdate function doesn't deliver correct values
Submitted: 2001-05-31 09:47 UTC Modified: 2001-05-31 12:51 UTC
From: phil at goli dot at Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.0.5 OS: FreeBSD 4.1.1-STABLE
Private report: No CVE-ID: None
 [2001-05-31 09:47 UTC] phil at goli dot at
// current date is 31.05.2001 GMT

// this should return '03' (5-2=3) -> OK
echo gmdate( "m", mktime(date("H"), date("i"), date("s"), date("m")-2, date("d"), date("Y")) ).'<br>';

// this should return '02' (5-3=2) -> but returns '03' !!!!
echo gmdate( "m", mktime(date("H"), date("i"), date("s"), date("m")-3, date("d"), date("Y")) ).'<br>';

// comment: yesterday it worked (on the 30.05.2001 GMT)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-31 10:04 UTC] phil at goli dot at
// Sorry - it's not a bug actually I think - it's just, that
// date("d") returns '31' in may - therefore the calculation
// does not work this way - if you use ... date("m")-2, 1, date("Y") ... it works!

// current date is 31.05.2001 GMT

// this should return '03' (5-2=3) -> OK
echo gmdate( "m", mktime(date("H"), date("i"), date("s"), date("m")-2, date("d"), date("Y")) ).'<br>';

// this should return '02' (5-3=2) -> but returns '03' !!!!
echo gmdate( "m", mktime(date("H"), date("i"), date("s"), date("m")-3, date("d"), date("Y")) ).'<br>';

// comment: yesterday it worked (on the 30.05.2001 GMT)
 [2001-05-31 12:51 UTC] sniper@php.net
user error.. (yes, some months don't have 31 days in them)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC