1 |
On 13/5/2011, at 8:32pm, Mick wrote: |
2 |
>>> ... |
3 |
>>> $ date +"%l:%M%P" |
4 |
>>> 8:39 |
5 |
>>> |
6 |
>>> That's the wall-clock time (p.m.) in my local time-zone. What Americans |
7 |
>>> call daylight savings time, though how they imagine any time is saved I |
8 |
>>> don't know. |
9 |
>> |
10 |
>> From `man date`: |
11 |
>> |
12 |
>> %l hour ( 1..12) |
13 |
>> |
14 |
>> ... |
15 |
>> %M minute (00..59) |
16 |
>> ... |
17 |
>> |
18 |
>> %p locale's equivalent of either AM or PM; blank if not known |
19 |
>> |
20 |
>> %P like %p, but lower case |
21 |
>> |
22 |
>> I'd be curious to compare with the output of `date +"%r"` on your system, |
23 |
>> but you probably actually want to set: |
24 |
>> |
25 |
>> LANG="en_GB.UTF-8" |
26 |
>> LC_TIME="POSIX" |
27 |
>> |
28 |
>> in order to get the correct results. |
29 |
> |
30 |
> Hmm ... I've just set my locale as you suggest and get: |
31 |
> |
32 |
> $ date +"%l:%M%P" |
33 |
> 8:29 |
34 |
> |
35 |
> (it's 20:29 right now) |
36 |
> |
37 |
> and |
38 |
> |
39 |
> $ date +"%r" |
40 |
> 08:31:28 |
41 |
|
42 |
Sorry, didn't see this message before sending my reply to your previous one. |
43 |
|
44 |
Yes, it should say "pm" at the end, but did you reboot before checking? |
45 |
|
46 |
I believe these are sourced at startup in a way that renders this necessary. |
47 |
|
48 |
You *may* be able to `export LC_TIME="POSIX"` in a shell, but I won't swear to it. |
49 |
|
50 |
Stroller. |