busybox date to show yesterday's date

walter harms wharms at bfs.de
Wed Apr 8 14:12:00 UTC 2009



Ming-Ching Tiew schrieb:
> 
> 
> --- 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.
> 
please beware that you need to know your needed precission. We have leap seconds
and if your system needs to be precise by one second you may fail unexpected.

re,
 wh






More information about the busybox mailing list