php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19620 wrong date
Submitted: 2002-09-26 13:51 UTC Modified: 2002-09-26 17:34 UTC
From: rsmeurer at terra dot com dot br Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.2.1 OS: FREE BSD 4.6
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rsmeurer at terra dot com dot br
New email:
PHP Version: OS:

 

 [2002-09-26 13:51 UTC] rsmeurer at terra dot com dot br
// why is this returning 1969-12-31 ???

$day = 13;
$month = 10;
$year = 2002;
echo date("Y-m-d",mktime (0,0,0,$month,$day,$year)); 

And MySQL also does the same when I insert '2002-10-13' in a date field!!!

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-26 13:55 UTC] tal@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.
 [2002-09-26 17:34 UTC] hholzgra@php.net
we really need a quickfix entry for this ... :(

due to daylight saving time there is no
such date as 2002-10-13 00:00:00 in brazil

the second following 2002-10-12 23:59:59
is 2002-10-13 01:00:00

so you requested the timestamp for an invalid
date, which is -1

and then you passed that on without checking 
to the date function, which took it as 
"the second before the unix epoch", being
1969-12-31 23:59:59
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 01:01:26 2025 UTC