Be sure to note that this is for 1.25.0; 1.24.2 may be different.
I got this by using "date -h", but whether or not usage syntax is
enabled depends on how your Busybox was built/configured.

I believe the TIME format section should answer your question (you need
to include hours and minutes, so try 00:00), ditto with -d/--date.

BusyBox v1.25.0 (2016-09-09 15:02:42 ICT) multi-call binary.

Usage: date [OPTIONS] [+FMT] [TIME]

Display time (using +FMT), or set time

        [-s,--set] TIME Set time to TIME
        -u,--utc        Work in UTC (don't convert to local time)
        -R,--rfc-2822   Output RFC-2822 compliant date string
        -I[SPEC]        Output ISO-8601 compliant date string
                        SPEC='date' (default) for date only,
                        'hours', 'minutes', or 'seconds' for date and
                        time to the indicated precision
        -r,--reference FILE     Display last modification time of FILE
        -d,--date TIME  Display TIME, not 'now'
        -D FMT          Use FMT for -d TIME conversion

Recognized TIME formats:
        YYYY-MM-DD hh:mm[:ss]
        'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead

| Jeremy Chadwick                          |
| UNIX Systems Administrator       |
| Making life hard for others since 1977.             PGP 4BD6C0CB |

On Thu, Sep 22, 2016 at 02:36:11PM -0500, wrote:
> hi,
> i'm trying to run my bash script (that works on my linux boxes) using
> busybox app (ru.meefik.busybox, ver. 1.24.2) on android
> 5.1.1(cyanogenmod 12) and i'm having trouble with date not supporting
> options. first it was "-d" that was causing issues. now busybox
> complains: "date: invalid option -- -"
> the code in question is here:
> TODAY=$(date +"%Y-%m-%d")   
> birthdate=$(($bday_yr$bday_mo$bday_day))   
> tmpDays=$(( ($(date --date="$TODAY" +%s) - $(date --date="$birthdate"
> +%s) )/(60*60*24) ))
> years=$(( $tmpDays / 365))
> so i guess it doesn't like the "--date".
> can anyone tell me how i'm supposed to get years (above) without using
> "-d", "--date", or any other unkown unsupported options? or maybe
> there's an accurate help file somehwere for busyboxe's date? the one i
> found online says "-d" is supported, but evidently that's not correct.
> thanks in advance
> -- 
> Information Technology Works
> @ITwrxorg
> _______________________________________________
> busybox mailing list
busybox mailing list

Reply via email to