On Sun, 26 Jul 2009, Denys Vlasenko wrote:

> Documentation was changed, IIRC in the same commit, to say
> [[[[[YY]YY]MM]DD]hh]mm[.ss] instead of MMDDhhmm[[YY]YY][.ss]:
>
> # ./busybox date --help
> BusyBox v1.15.0.svn (2009-07-26 13:45:10 CEST) multi-call binary
>
> Usage: date [OPTIONS] [+FMT] [TIME]
> ...
> Recognized formats for TIME:
>         hh:mm[:ss]
>         [YYYY.]MM.DD-hh:mm[:ss]
>         YYYY-MM-DD hh:mm[:ss]
>         [[[[[YY]YY]MM]DD]hh]mm[.ss]
>
> (It seems that MMDDhhmm[[YY]YY][.ss] format was a bbox invention,
> because it's slightly easier to parse. Google didn't show any
> other programs which use such format. See a comment in libbb/time.c)

Right.  Sorry, missed that :(

Noticed though some discrepecies bbox vs. gnu date.
See attached, which reveals the oddities.


Cheers,

-- 
Cristian
diff --git a/testsuite/date/date-format-works b/testsuite/date/date-format-works
index f2a2091..93ed494 100644
--- a/testsuite/date/date-format-works
+++ b/testsuite/date/date-format-works
@@ -2,3 +2,9 @@
 # but accepts '2000-11-22 11:22:33'. We must follow.
 test x"01/01/99" = x"`busybox date -d 1999.01.01-11:22:33 '+%d/%m/%y'`"
 test x"22/11/00" = x"`busybox date -d 2000.11.22-11:22:33 '+%d/%m/%y'`"
+
+test x"$(date -d '1999-01-01 11:22:33' '+%d/%m/%y %T')" = x"$(busybox date -d '1999-01-01 11:22:33' '+%d/%m/%y %T')"
+test x"$(date -d '2000-11-22 11:22:' '+%d/%m/%y %T' 2>/dev/null)" = x"$(busybox date -d '2000-11-22 11:22:' '+%d/%m/%y %T' 2>/dev/null)"
+test x"$(date -d '2000-11-22 11:22' '+%d/%m/%y %T')" = x"$(busybox date -d '2000-11-22 11:22' '+%d/%m/%y %T')"
+test x"$(date -d '1984-12-23 11:' '+%d/%m/%y %T' 2>/dev/null)" = x"$(busybox date -d '1984-12-23 11:' '+%d/%m/%y %T' 2>/dev/null)"
+test x"$(date -d '1984-04-04 11' '+%d/%m/%y %T')" = x"$(busybox date -d '1984-04-04 11' '+%d/%m/%y %T')"
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to