Doc #76378 [NEW]: strftime format "%p" is not always uppercase "AM/PM"

From: Date: Fri, 25 May 2018 16:17:24 +0000
Subject: Doc #76378 [NEW]: strftime format "%p" is not always uppercase "AM/PM"
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15712@lists.php.net to get a copy of this message
From: webmaster at deltik dot org Operating system: CloudLinux 7.5 and Ubuntu 18.04 PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:strftime format "%p" is not always uppercase "AM/PM" Description: ------------ When the LC_TIME locale is set to "en_GB.UTF-8", the "%p" conversion specification returns lowercase "am" or "pm" instead of the documented "AM" or "PM". PHP documentation: https://secure.php.net/manual/en/function.strftime.php The documentation for the "%p" conversion specification reads: > UPPER-CASE 'AM' or 'PM' based on the given time In man 3 strftime, the description reads: > 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". The "en_GB.UTF-8" locale always expresses "am" and "pm" as lowercase, which makes the PHP documentation inaccurate. Sources: - https://sourceware.org/bugzilla/show_bug.cgi?id=3768 - https://en.wikipedia.org/wiki/Date_and_time_notation_in_the_United_Kingdom The documentation should be updated to explain that "%p" is "AM" or "PM" in the current locale, not necessarily uppercase, and that "%P" is the same as "%p" except lowercase. --------------- This bug was discovered in a unit test of a PHP application: https://github.com/e107inc/e107-test/pull/5#issuecomment-391903312 --------------- The "Expected result" below is what we should see if the PHP documentation were to be trusted. The "Actual result" is correct according to the actual strftime function. Test script: --------------- <?php echo setlocale(LC_TIME, "en_GB.UTF-8") . PHP_EOL . strftime("%I:%M %p", "1517834703") . PHP_EOL; echo PHP_EOL; echo setlocale(LC_TIME, "C") . PHP_EOL . strftime("%I:%M %p", "1517834703") . PHP_EOL; Expected result: ---------------- en_GB.UTF-8 12:45 PM C 12:45 PM Actual result: -------------- en_GB.UTF-8 12:45 pm C 12:45 PM -- Edit bug report at https://bugs.php.net/bug.php?id=76378&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76378&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76378&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76378&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76378&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76378&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76378&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76378&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76378&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76378&r=support Expected behavior: https://bugs.php.net/fix.php?id=76378&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76378&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76378&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76378&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76378&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76378&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76378&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76378&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76378&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76378&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76378&r=mysqlcfg

« previous php.doc.bugs (#15712) next »