From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: can zsh / strftime do "date math"?
Date: Mon, 17 Oct 2011 00:15:40 -0700 [thread overview]
Message-ID: <111017001540.ZM5427@torch.brasslantern.com> (raw)
In-Reply-To: <CADjGqHvM1EqQxLpJTugMr73FLbPPtHF+AVdz=qKZuhtr4shYLA@mail.gmail.com>
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".
prev parent reply other threads:[~2011-10-17 7:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-17 5:36 TJ Luoma
2011-10-17 7:15 ` 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=111017001540.ZM5427@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).