zsh-users
 help / color / mirror / code / Atom feed
* Is it possible to get a 4-char year in WATCHFMT
@ 2015-02-27 21:39 rj
  2015-02-27 22:02 ` rj
  0 siblings, 1 reply; 3+ messages in thread
From: rj @ 2015-02-27 21:39 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 125 bytes --]


"%D" in WATCHFMT prints a 2-char year.  Is there a way one can get a 4-char
year?  Does WATCHFMT take strftime sequences?



[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to get a 4-char year in WATCHFMT
  2015-02-27 21:39 Is it possible to get a 4-char year in WATCHFMT rj
@ 2015-02-27 22:02 ` rj
  2015-02-28  6:27   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: rj @ 2015-02-27 22:02 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]


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.

man strftime says that *its* "%A" is "The full weekday name according to the
current locale."

[-- Attachment #2: Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Is it possible to get a 4-char year in WATCHFMT
  2015-02-27 22:02 ` rj
@ 2015-02-28  6:27   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2015-02-28  6:27 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-28  6:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 21:39 Is it possible to get a 4-char year in WATCHFMT rj
2015-02-27 22:02 ` rj
2015-02-28  6:27   ` Bart Schaefer

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).