I need to the date three days from today. On CentOS, I can run the below command.
date -I -d "-3 days"
Which outputs
2022-07-02
I need the same inside my Docker container which is running on Alpine Linux 3.14.6v.
When I execute the same command I am getting the error:
date: invalid date ‘-3 days’
Anyone knows the workaround for this?
2
Answers
From StackExchange.com:
A way to do it could be to use a bit of arithmetic on a timestamp, then translate the timestamp back into a date:
Given
It would yield: