|
|
|
|
|
by ydant
801 days ago
|
|
Not knocking the tool, just an alternative for people who might not be aware. GNU date almost does the same as their examples: date -Is -ud 'today' --> 2024-04-12T14:04:08+00:00
date -Is -ud 'tomorrow' --> 2024-04-13T14:04:08+00:00
date -Is -ud '2 day' --> 2024-04-14T14:04:08+00:00
date -Is -ud '9 week' --> 2024-06-14T14:04:08+00:00
date -Is -ud '1 month' --> 2024-05-12T14:04:08+00:00
date -Is -ud '2024-04-10T13:31:46+04:00' --> 2024-04-10T09:31:46+00:00
date -Is -ud 'Wed, 14 Feb 2024 23:16:09 GMT' --> 2024-02-14T23:16:09+00:00
And if you want Z format, you can use a custom format string: date -ud '1 month' +'%FT%TTZ' --> 2024-05-12T14:13:22TZ
So it would be easy enough to add an alias/function to your shell configurations and just use built-in date rather than installing a new program. Assuming GNU date relative date parsing meets your needs - I don't think it's quite as flexible as some libraries, e.g. in Python. |
|