I've been looking for a solution online but couldn't find anything useful.
Running the same command works on busybox 1.29.2 but no longer on 1.30.1.
We are trying to offset the date by running this command:
echo $(date -D %s +%m%d%H%M -d "$(($(date +%s) - 4200))")
on 1.29.2 it gives the correct output
on 1.30.1 it gives the error message date: invalid date '1592225794'
Did something change syntax-wise? Any other ideas how to offset the date by for example +2 hours? Ideal output format is %m%d%H%M
.
I don't know what they changed, but -D %s
is redundant there; busybox date supports -d @SECONDS_SINCE_EPOCH
since version 1.17.x.
$ date +%m%d%H%M -d @$(($(date +%s)-4200))
06151525
$ date
Mon Jun 15 16:35:22 +03 2020