The GNU date
command can output date computed from relative items such as -1 hour
or 1 month ago
. It can also output date from different input format (for instance calendar date, seconds since epoch, etc...).
Is it possible to combine both a date format and a relative time to compute a new date from a given date using the GNU§ date
utility?
Something like:
date_epoch=`date "+%s"`
date --date="@$date_epoch -1 month"
The second command gives an "incorrect date" error...