[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35078: Possible bug in the date command, to do with %p
From: |
Assaf Gordon |
Subject: |
bug#35078: Possible bug in the date command, to do with %p |
Date: |
Tue, 2 Apr 2019 10:48:45 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 |
tags 35078 notabug
close 35078
stop
Hello,
On 2019-04-02 2:14 a.m., Nicholas Joll wrote:
The manual for 'date' includes this:
%p locale's equivalent of either AM or PM; blank if not known
%P like %p, but lower case
But on my system:
$ date +%p
am
$ date +%P
am
That is: it seems impossible to get a capitalised 'AM' or 'PM'.
Might this be a problem with my locale? Here is how my locale is set:
$ locale
LANG=en_GB.UTF-8
Exactly as you suspected: it is due to your locale.
Note the wording:
"locale's *equivalent* of either AM or PM"
So not the exact strings AM or PM, but what your locate uses.
In C/POSIX, these are indeed upper/lower case:
$ LC_ALL=C date +"%p %P"
AM am
Same for Canada:
$ LC_ALL=en_CA.UTF-8 date +"%p %P"
AM am
But not for Great Britain:
$ LC_ALL=en_GB.UTF-8 date +"%p %P"
am am
Also note that these are blank in many other locales:
$ LC_ALL=ru_RU.utf8 date +"=%p=%P="
===
I'm making this as "not a bug", but discussion can continue by
replying to this thread.
-assaf