The reason date -h etc. doesn't work is because, as described, your
Busybox was built with support for such disabled. You will need to talk
to whoever maintains your Busybox package/install, or if that's you,
then you need to consider tweaking the config further for such.
I have no problem with date on Busybox 1.25.0 with regards to most of
your script's date syntaxes, as well as others shown in the syntax
First, your TODAY:
root@gw:/tmp/home/root# date +"%Y-%m-%d"
Now your tmpDays, but I'll use a different date than the above, to show
root@gw:/tmp/home/root# date --date="2002-12-20"
Fri Dec 20 00:00:00 PST 2002
root@gw:/tmp/home/root# date --date="2002-12-20" +%s
Verifying that UNIX timestamp correlates with the correct date:
root@gw:/tmp/home/root# perl -e 'print scalar localtime(1040371200), "\n";'
Fri Dec 20 00:00:00 2002
In tmpDays, you use something called $birthdate, which uses variables
that aren't defined (in the code you showed), so I can't tell if they're
2-digit years, 4-digit years, variable-width month values, or what, thus
I cannot test that.
The only two compile-time date tweaking options I see are
CONFIG_FEATURE_DATE_ISOFMT and CONFIG_FEATURE_DATE_COMPAT, but I don't
believe these are relevant:
33 //config:config FEATURE_DATE_ISOFMT
34 //config: bool "Enable ISO date format output (-I)"
35 //config: default y
36 //config: depends on DATE
37 //config: help
38 //config: Enable option (-I) to output an ISO-8601 compliant
39 //config: date/time string.
50 //config:config FEATURE_DATE_COMPAT
51 //config: bool "Support weird 'date MMDDhhmm[[YY]YY][.ss]' format"
52 //config: default y
53 //config: depends on DATE
54 //config: help
55 //config: System time can be set by 'date -s DATE' and simply 'date
56 //config: but formats of DATE string are different. 'date DATE' accepts
57 //config: a rather weird MMDDhhmm[[YY]YY][.ss] format with completely
58 //config: unnatural placement of year between minutes and seconds.
59 //config: date -s (and other commands like touch -d) use more sensible
60 //config: formats (for one, ISO format YYYY-MM-DD hh:mm:ss.ssssss).
62 //config: With this option off, 'date DATE' is 'date -s DATE' support
63 //config: the same format. With it on, 'date DATE' additionally supports
64 //config: MMDDhhmm[[YY]YY][.ss] format.
That leaves reviewing changes between Busybox 1.24.2 and 1.25.0, so
let's look at that, specifically looking for tags of 1_24_2 and 1_25_0:
I see nothing in the 1_24_stable commit history, after 1_24_2, that
indicates fixes/tweaks for date, so I don't have an immediate
That said: is there a reason you're omitting depiction of the actual
problem? You've given descriptions, but aren't pasting full terminal
output. It would help because then one could reverse-engineer some of
the messages shown back to code and see if the cause could be
| Jeremy Chadwick j...@koitsu.org |
| UNIX Systems Administrator http://jdc.koitsu.org/ |
| Making life hard for others since 1977. PGP 4BD6C0CB |
On Thu, Sep 22, 2016 at 05:47:43PM -0500, ITwrx.org wrote:
> On 09/22/2016 05:08 PM, Jeremy Chadwick wrote:
> > 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:
> > hh:mm[:ss]
> > [YYYY.]MM.DD-hh:mm[:ss]
> > YYYY-MM-DD hh:mm[:ss]
> > [[[[[YY]YY]MM]DD]hh]mm[.ss]
> > 'date TIME' form accepts MMDDhhmm[[YY]YY][.ss] instead
> thanks for your help. "date -h" doesn't work on mine, nor "man date" or
> "date --help". am i understanding you correctly that "-d" and "--date"
> are supported
> but if you don't give it the time format correctly it reports the error
> erroneously by saying that the option itself is not supported when it
> really is trying to report that the time format was invalid?
> Information Technology Works
busybox mailing list