From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23193 invoked by alias); 26 Nov 2012 11:33:37 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 17439 Received: (qmail 29253 invoked from network); 26 Nov 2012 11:33:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at internecto.net designates 176.9.245.29 as permitted sender) X-Virus-Scanned: Debian amavisd-new at mail.internecto.net Message-ID: <50B35385.8040409@internecto.net> Date: Mon, 26 Nov 2012 12:33:25 +0100 From: Mark van Dijk User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: "zsh-users@zsh.org" Subject: Date prompt expansion Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Following up on my email sent yesterday where I asked a question about pcre, the question also implied I'm doing stuff with dates. Currently I am using two different methods of getting the today's day/month and yesterday's day/month: 1) for today I'm using prompt expansion: todaysDay=${(%):-%D{"%d"}} # 26 todaysMonth=${(%):-%D{"%m"}} # 11 2) for yesterday I'm using FreeBSD's date command: yesterdaysDay=$(/bin/date -v -1d "+%y") yesterdaysMonth=$(/bin/date -v -1d "+%m") I'm more fond of the first method. Can the second be done without calling /bin/date? Mark