zsh-users
 help / color / mirror / code / Atom feed
From: TJ Luoma <luomat@gmail.com>
To: zsh-users@zsh.org
Subject: can strftime show 'p.m.' instead of 'PM'?
Date: Sat, 28 Apr 2012 14:55:25 -0400	[thread overview]
Message-ID: <29B9CC7BDEB94DA784265196AE5C7EEE@gmail.com> (raw)


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




             reply	other threads:[~2012-04-28 19:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-28 18:55 TJ Luoma [this message]
2012-04-28 21:10 ` Benjamin R. Haskell
2012-04-28 21:45   ` TJ Luoma
2012-04-28 21:20 ` Mark van Dijk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=29B9CC7BDEB94DA784265196AE5C7EEE@gmail.com \
    --to=luomat@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).