busybox date to show yesterday's date

Ming-Ching Tiew mctiew at yahoo.com
Wed Apr 8 12:30:00 UTC 2009




--- On Wed, 4/8/09, Ralf Friedl <Ralf.Friedl at online.de> 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
> 

This is exactly what I need.

Thanks.


      


More information about the busybox mailing list