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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dgw at qlogic dot net
New email:
PHP Version: OS:

 

 [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: Sat Apr 27 12:01:29 2024 UTC