php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46712 strftime : %p tag does "AM/PM" and not "am/pm"
Submitted: 2008-11-28 16:51 UTC Modified: 2011-02-04 12:02 UTC
From: evaisse at gmail dot com Assigned: rquadling (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: ubuntu/linux
Private report: No CVE-ID: None
 [2008-11-28 16:51 UTC] evaisse at gmail dot com
Description:
------------
doc say : 

%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale 

Must be corrected said in the comments :

%p - either `AM' or `PM' according to the given time value, or the corresponding strings for the current locale (note result is in capitals)
%P - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale (note result is in lower case)

Very vicious bug by the way.

Reproduce code:
---------------
print strftime('%p',time()); // time before 12, must print 'am'



Expected result:
----------------
am

Actual result:
--------------
AM

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-28 23:16 UTC] danbrown@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 [2011-02-03 21:20 UTC] ssanders at bookmasters dot com
I am on PHP 5.2.10, and %p returns lowercase am/pm, contrary to current docs..?
 [2011-02-04 12:00 UTC] rquadling@php.net
-Assigned To: +Assigned To: rquadling
 [2011-02-04 12:00 UTC] rquadling@php.net
Can you run the example at 
http://docs.php.net/manual/en/function.strftime.php#example-637. This will show 
you all the formats that your operating system can provide and the current 
values.

I'm on Windows and I've tested V5.0.0 to V5.3.5 (77 versions including alpha and 
RCs). %P is not supported and %p is always uppercase AM or PM.

You may find your OS reports something different. Take careful notice of 
http://docs.php.net/manual/en/function.strftime.php#refsect1-function.strftime-
errors. The output is OS dependent.
 [2011-02-04 12:00 UTC] rquadling@php.net
Can you run the example at http://docs.php.net/manual/en/function.strftime.php#example-637. This will show you all the formats that your operating system can provide and the current values.

I'm on Windows and I've tested V5.0.0 to V5.3.5 (77 versions including alpha and RCs). %P is not supported and %p is always uppercase AM or PM.

You may find your OS reports something different. Take careful notice of http://docs.php.net/manual/en/function.strftime.php#refsect1-function.strftime-errors. The output is OS dependent.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 15:00:02 2026 UTC