zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Is it possible to get a 4-char year in WATCHFMT
Date: Fri, 27 Feb 2015 22:27:16 -0800	[thread overview]
Message-ID: <150227222716.ZM20870@torch.brasslantern.com> (raw)
In-Reply-To: <20150227220258.GA22603@panix.com>

On Feb 27,  5:02pm, rj wrote:
}
} On Fri 27 at 04:39 PM -0500, rj <rj@panix.com> wrote:
} 
} > "%D" in WATCHFMT prints a 2-char year. Is there a way one can get a
} > 4-char year? Does WATCHFMT take strftime sequences?
} 
} Actually, I see on one of my logins I was able to do it this way:
} 
} %D{%A      %Y-%m-%d}
} 
} Though I don't remember what "%A" does, and it isn't listed as an available
} sequence in the "WATCHFMT" setion in man zshall.

Although the doc was never updated to say so, %D in WATCHFMT behaves the
same way as %D in PROMPT.  So you can follow it with a strftime format
enclosed in curly braces.  It also supports the zsh format extensions
described for prompt escapes.

It's been that way for at least 16 years without ever getting doc'd.


diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 273be21..d044f87 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1548,6 +1548,12 @@ The date in `var(mm)tt(/)var(dd)tt(/)var(yy)' format.
 item(tt(%D))(
 The date in `var(yy)tt(-)var(mm)tt(-)var(dd)' format.
 )
+item(tt(%D{)var(string)tt(}))(
+The date formatted as var(string) using the tt(strftime) function, with
+zsh extensions as described by
+ifzman(EXPANSION OF PROMPT SEQUENCES in zmanref(zshmisc))\
+ifnzman(noderef(Prompt Expansion)).
+)
 item(tt(%LPAR())var(x)tt(:)var(true-text)tt(:)var(false-text)tt(RPAR()))(
 Specifies a ternary expression.
 The character following the var(x) is


      reply	other threads:[~2015-02-28  6:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 21:39 rj
2015-02-27 22:02 ` rj
2015-02-28  6:27   ` Bart Schaefer [this message]

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=150227222716.ZM20870@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).