php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46501 date() doesn't account for daylights savings & am/pm returns incorrectly
Submitted: 2008-11-06 09:24 UTC Modified: 2008-11-06 11:16 UTC
From: micah_blu at bluprintsmedia dot net Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.6 OS: Linux
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: micah_blu at bluprintsmedia dot net
New email:
PHP Version: OS:

 

 [2008-11-06 09:24 UTC] micah_blu at bluprintsmedia dot net
Description:
------------
date() doesn't account for daylights savings & am/pm returns incorrectly. The date("I") returns 0 even though it should return 1. Here is system info produced by phpinfo():

:Linux p3slh166.shr.phx3.secureserver.net 2.4.21-53.ELsmp #1 SMP Wed Nov 14 03:54:12 EST 2007 i686

The server is not dedicated.
Would appreciate any help you could give!

Reproduce code:
---------------
date("Y-m-d h:i a); //returns am times as pm and is 1 hour ahead.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-06 11:16 UTC] jani@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 18:01:31 2025 UTC