php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49481 strftime format documentation error
Submitted: 2009-09-06 10:26 UTC Modified: 2009-09-06 10:41 UTC
From: liphtier at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.10 OS:
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: liphtier at gmail dot com
New email:
PHP Version: OS:

 

 [2009-09-06 10:26 UTC] liphtier at gmail dot com
Description:
------------
In the manual page: function.strftime stated

> %p 	UPPER-CASE 'AM' or 'PM' based on the given time
> Example: AM for 00:31, PM for 22:23
> %P 	lower-case 'am' or 'pm' based on the given time
> Example: am for 00:31, pm for 22:23


the actual format is exactly wise versa:
%p is  for lower-case and %P is for UPPER-CASE.



Reproduce code:
---------------
---
From manual page: function.strftime
---


Expected result:
----------------
> %P 	UPPER-CASE 'AM' or 'PM' based on the given time
> Example: AM for 00:31, PM for 22:23
> %p 	lower-case 'am' or 'pm' based on the given time
> Example: am for 00:31, pm for 22:23

Actual result:
--------------
> %p 	UPPER-CASE 'AM' or 'PM' based on the given time
> Example: AM for 00:31, PM for 22:23
> %P 	lower-case 'am' or 'pm' based on the given time
> Example: am for 00:31, pm for 22:23

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-06 10:41 UTC] derick@php.net
You are wrong.

From the Linux manual:

       %p     Either "AM" or "PM" according to the given time  value,  or  the
              corresponding  strings  for the current locale.  Noon is treated
              as "PM" and midnight as "AM".

       %P     Like %p but in lowercase: "am" or "pm" or a corresponding string
              for the current locale. (GNU)


In PHP:
php -r "echo strftime('%p %P' );"
AM am
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Apr 05 08:01:29 2025 UTC