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

Re: Date prompt expansion



On Mon, 26 Nov 2012 12:33:25 +0100
Mark van Dijk <lists+zsh@xxxxxxxxxxxxxx> wrote:
> 2) for yesterday I'm using FreeBSD's date command:
> yesterdaysDay=$(/bin/date -v -1d "+%y")
> yesterdaysMonth=$(/bin/date -v -1d "+%m")

(You probably mean "+%d" rather "+%y" in the first one.)

Up to oddities with leap seconds, you can do it by

zmodload zsh/datetime
strftime -s yesterdaysDay "+%d" $(( EPOCHSECONDS - 24 * 60 * 60 ))

pws



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