date formats acceptable to the "date" command

David Collier from_busybox_maillist at dexdyne.com
Mon Jan 17 11:16:00 UTC 2011


Walter,

Denys

So the posix spec is the one that has recently been deleted. I guess that
enhances the argument for supporting it.

Denys - I can see you have access to many more varieties than I have - I
confess I had no idea there were so many.

So my goal of making up a version which works on "busybox" or "big linux"
is rather fatally flawed anyway, as there is no such single thing in this
case.

David






In article <4D340CDF.10807 at bfs.de>, wharms at bfs.de (walter harms) wrote:

> *From:* walter harms <wharms at bfs.de>
> *To:* Denys Vlasenko <vda.linux at googlemail.com>
> *CC:* busybox at busybox.net, from_busybox_maillist at dexdyne.com,  
> jeredb at dexdyne.com
> *Date:* Mon, 17 Jan 2011 10:33:19 +0100
> 
> Am 15.01.2011 19:24, schrieb Denys Vlasenko:
> > On Friday 14 January 2011 13:47, David Collier wrote:
> >> In article 
> <memo.20110114113746.14188A at postmaster+dexdyne.com.cix.co.uk>,
> >> from_busybox_maillist at dexdyne.com (David Collier) wrote:
> >>
> >>> *From:* "David Collier" <from_busybox_maillist at dexdyne.com>
> >>> *To:* busybox at busybox.net
> >>> *CC:* jered at dexdyne.com
> >>> *Date:* Fri, 14 Jan 2011 11:37 +0000 (GMT Standard Time)
> >>>
> >>> "big linux" date command seems to like a single format when you 
> are
> >>> setting the date
> >>>
> >>> that is [MMDDhhmm[[CC]YY][.ss]]
> >>>
> >>> if I do "date --help" in busybox it says:
> >>>
> >>> 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]
> >>>
> >>> which doesn't seem to allow for MMDDhhmmCCYY
> >>>
> >>> however when I experiment with
> >>>
> >>>    date 011410032011
> >>>
> >>>    it all seems to work as desired.
> >>
> >> rubbish - I screwed my tests
> >>
> >> it worked          in 1.13.1, 
> >>      though it wasn't documented as an acceptable format
> >> it no longer works in 1.17.4
> >>
> >> So I guess the help file is now telling the truth.
> >>
> >> It seems a bit silly not to accept the only standard format as 
> used by
> >> the coreutils version?
> > 
> > There seems to be no consensus between Unix-like systems on this:
> > 
> > 
> > 
> > 
> http://developer.apple.com/library/mac/#documentation/darwin/referen
> ce/manpages/man1/date.1.html
> > DATE(1)                                  BSD General Commands 
> > Manual                                 DATE(1)
> > SYNOPSIS
> >      date [-jnu] [[[mm]dd]HH]MM[[cc]yy][.ss]
> > 
> > http://www.daemon-systems.org/man/date.1.html
> > DATE(1)                 NetBSD General Commands Manual            
> >      DATE(1)
> > SYNOPSIS
> >      date [-ajnu] [-d date] [-r seconds] [+format] 
> > [[[[[[CC]yy]mm]dd]HH]MM[.SS]]
> > 
> > http://ss64.com/osx/date.html
> > Syntax
> >       date [-nu] [-r seconds] [+format] 
> > [[[[[cc]yy]mm]dd]hh]mm[.ss]
> > 
> > http://unixhelp.ed.ac.uk/CGI/man-cgi?date
> > DATE(1) 			 User Commands			       DATE(1)
> > SYNOPSIS
> >        date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
> > 
> > "man date" on Fedora:
> > DATE(1)                          User Commands                    
> >      DATE(1)
> > SYNOPSIS
> >        date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
> > 
> > 
> >>From these five examples, two use [[cc]yy]mmddhhmm[.ss] and three
> > use mmddhhmm[[cc]yy][.ss] format.
> > 
> > 
> > But for another tool, touch, all manpages I was able to find 
> > uniformly say
> > that "touch -t DT" accepts DT = [[cc]yy]mmddhhmm[.ss] format on 
> > every Unix.
> > None of them use mmddhhmm[[cc]yy][.ss] for it.
> > 
> > 
> > I am torn here. From one POV, compatibility with "big Linux" date 
> > is good.
> >>From another, mmddhhmm[[cc]yy][.ss] format is (a) stupid, (b) 
> does not match
> > "touch -t" format, and (c) doesn't seem to be the universally 
> > accepted syntax
> > in wider Unix world.
> > 
> > 
> 
> For completness the POSIX manual says:
>  date [-u] mmddhhmm[[cc]yy]
> 
> re,
>  wh
> 
> 
> 


More information about the busybox mailing list