From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1269 invoked by alias); 17 Oct 2011 07:16:09 -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: 16494 Received: (qmail 17948 invoked from network); 17 Oct 2011 07:15:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <111017001540.ZM5427@torch.brasslantern.com> Date: Mon, 17 Oct 2011 00:15:40 -0700 In-reply-to: Comments: In reply to TJ Luoma "can zsh / strftime do "date math"?" (Oct 17, 1:36am) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: can zsh / strftime do "date math"? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 17, 1:36am, TJ Luoma wrote: } Subject: can zsh / strftime do "date math"? } } I use the 'gdate' program the from the GNU coreutils to do "date math" } (I don't know if that's the right term or not). } } For example, if I wanted to know the time would be in 17 hours, 14 } minutes, and 6 seconds, I would use } } gdate --date "+ 17 hours 14 minutes 06 seconds" The closest would be: zmodload zsh/datetime strftime '%Y%m%d %H:%M:%S' $[EPOCHSECONDS + (17 * 60 + 14) * 60 + 6] You can also parse datetimes with "strftime -r" but you must include the year month and day and which must be more recent than 1969/12/12, so you can't use it to parse "+ 17 hours 14 minutes 06 seconds".