php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15455 date() fails with negative timestamps
Submitted: 2002-02-08 14:45 UTC Modified: 2002-02-08 17:47 UTC
From: dgw at qlogic dot net Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.1.1 OS: Windows 2000
Private report: No CVE-ID: None
 [2002-02-08 14:45 UTC] dgw at qlogic dot net
Simple to reproduce, only on windows:

$date = mktime(0,0,0,5,5,1965);
echo date('d-m-Y', $date);

This happens with timestamps before 01/01/1970 that results in a negative number (like birth dates, for example).


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-08 15:29 UTC] derick@php.net
It's a limitation in windows' date routines. I'm afraid we can little do about it for now.

Derick
 [2002-02-08 17:47 UTC] mfischer@php.net
Just for clarification:

"localtime returns a pointer to the structure result. If the value in timer represents a date before midnight, January 1, 1970, localtime returns NULL." - right from the MSDN. And a NULL value can't be used to turn into something meaningful.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC