Re: How to calculate date relative to another date?
From:
Sami Kerola
Subject:
Re: How to calculate date relative to another date?
Date:
Tue, 21 May 2019 20:46:26 +0100
On Tue, 21 May 2019 at 19:00, Peng Yu <address@hidden> wrote:
> For example, I want to calculate 5 years less a month from May 2018,
> i.e., "2018/05", the result should be "2013/06".
>
>https://www.gnu.org/software/coreutils/manual/html_node/Examples-of-date.html
>
> I don't think the direct calculation of this kind of relative date is
> possible with coreutiles' date command. Some kind of external
> arithmetic calculation must be used. Is it so?
Seems to work fine when date specification is not quite as ambiguous
as "2018/05".
$ date --iso --date='2018-05-01 5 years ago'
2013-05-01
--
Sami Kerola
http://www.iki.fi/kerolasa/