[Cialug] Calculating dates relative to today
kristau
kristau at gmail.com
Fri Mar 1 18:38:57 UTC 2024
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:
*90 days from today?*
kristau at pop-thelio:~$ touch -d '90 day' test; stat test
File: test
Size: 0 Blocks: 0 IO Block: 4096 regular empty
file
Device: fc01h/64513d Inode: 46138998 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ kristau) Gid: ( 1000/ kristau)
*Access: 2024-05-30 13:30:47.677889558 -0500Modify: 2024-05-30
13:30:47.677889558 -0500*
Change: 2024-03-01 12:30:47.677657453 -0600
Birth: 2024-03-01 12:30:25.265369754 -0600
*90 days ago?*
kristau at pop-thelio:~$ touch -d '-90 day' test; stat test
File: test
Size: 0 Blocks: 0 IO Block: 4096 regular empty
file
Device: fc01h/64513d Inode: 46138998 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 1000/ kristau) Gid: ( 1000/ kristau)
*Access: 2023-12-02 12:32:53.049962148 -0600Modify: 2023-12-02
12:32:53.049962148 -0600*
Change: 2024-03-01 12:32:53.047266778 -0600
Birth: 2024-03-01 12:30:25.265369754 -0600
Might not be new to you, but it was new to me so I thought I'd share!
--
Tired programmer
Coding late into the night
The core dump follows
More information about the Cialug
mailing list