busybox date to show yesterday's date

Ralf Friedl Ralf.Friedl at online.de
Wed Apr 8 11:14:40 UTC 2009



Ming-Ching Tiew wrote:
> This works for gnu date :-
>
>        # date -d yesterday
>
> Does not work for busybox
>
>        # date -d yesterday
> date: invalid date 'yesterday'
>
> Short of putting gnu date on the system, anyone has a nice workaround for it  ?
>
> Regards
You can use this:

./busybox date -D %s -d $(( $(./busybox date +%s) - 86400 ))

86400 = 24*60*60 = 1 day

Regards
Ralf Friedl


More information about the busybox mailing list