|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46589 am/pm issue
Submitted: 2008-11-17 05:28 UTC Modified: 2008-11-25 01:00 UTC
Avg. Score:3.6 ± 1.5
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:2 (25.0%)
From: micah_blu at bluprintsmedia dot net Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 5.2.6 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-11-17 05:28 UTC] micah_blu at bluprintsmedia dot net
date() function returns wrong am/pm, usually always outputs am instead of pm

Reproduce code:
echo date("Y-m-d h:i a");

Expected result:
2008-11-16 9:26 pm

Actual result:
2008-11-16 9:26 am


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-17 09:40 UTC]
Well, if you run in before noon you'll get am. Check your server time using 24h format instead of the braindead american am/pm crap.
 [2008-11-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2009-03-27 00:11 UTC] mjharmon at email dot arizona dot edu
mjharmon@mx ~ $ php timetest.php
2009-03-26 05:03:20 MST GMT-0700 US/Arizona


mjharmon@mx ~ $ date
Thu Mar 26 17:10:34 MST 2009

mjharmon@mx ~ $ cat timetest.php
print date('Y-m-d h:m:s T \G\M\TO e') . "\n";


Timezone is correct, date is not.
 [2009-03-27 00:13 UTC] mjharmon at email dot arizona dot edu
Correction, date and timezone are correct. Timestamp (as in the time part) is not correct.
 [2009-03-27 00:30 UTC] mjharmon at email dot arizona dot edu
Update. New results:

mjharmon@mx ~ $ date
Thu Mar 26 17:25:16 MST 2009
mjharmon@mx ~ $ php timetest.php
2009-03-26 05:03:19 MST GMT-0700 US/Arizona
Thu, 26 Mar 2009 17:25:19 -0700

print date('Y-m-d h:m:s T \G\M\TO e') . "\n";
print date('r');


Apparently, the initial time was GMT (without taking into account the timezone?) But using the rfc2822 format made the date times match up.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 15:01:24 2021 UTC