Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

can strftime show 'p.m.' instead of 'PM'?



Before I begin, I should say that I realize this may (seem to) be extremely picayune, but it consistently annoys me. Judge me as you will :-)

`man strftime` says this:

     %p    is replaced by national representation of either "ante meridiem" (a.m.)  or "post meridiem" (p.m.)  as appropriate.

     %F    is equivalent to ``%Y-%m-%d''.

     %r    is equivalent to ``%I:%M:%S %p''.

However when I do this in zsh

$ strftime "%F %r" "$EPOCHSECONDS"

I get this:

2012-04-28 02:50:24 PM

Ideally I would like "PM" to be "p.m." but I'd probably settle for "pm"

I tried using '%P' instead of '%p' (thinking that might invert the case) but that just gave me a literal 'P' instead.

I realize that I could use:

strftime "%F %r" "$EPOCHSECONDS" | tr '[A-Z]' '[a-z]'

or even

strftime "%F %r" "$EPOCHSECONDS" | sed 's#AM#a.m#g; s#pPM#p.m.#g'

but I wondered if there was a better (more efficient) way.

Thanks

TjL





Messages sorted by: Reverse Date, Date, Thread, Author