[Cialug] Calculating dates relative to today

Jonathan A. Kollasch jakllsch at kollasch.net
Fri Mar 1 18:52:00 UTC 2024


On Fri, Mar 01, 2024 at 12:38:57PM -0600, kristau wrote:
> Just discovered this nifty command-line hack to calculate dates relative to
> today instead of using some random date-calculating website or counting
> squares on an old fashioned wall-hanger:
> 
> touch -d 'X day' test; stat test
> 
> Examples:
~~~
> Might not be new to you, but it was new to me so I thought I'd share!

My go-to for this sort of thing is Python datetime:

>>> import datetime;datetime.date(2024,2,29)+datetime.timedelta(1)
datetime.date(2024, 3, 1)


More information about the Cialug mailing list