On Sun, Mar 27, 2016 at 02:34:26AM -0600, Bob Proulx wrote:
$ date -d 00:59
Sun 27 Mar 00:59:00 GMT 2016
$ date -d "Sun 27 Mar 00:59:00 GMT 2016"
date: invalid date ‘Sun 27 Mar 00:59:00 GMT 2016’

Unfortunately that input is not in a locale independent format.  That
is why it cannot be read by date in the above.  The date documentation
says this:

 ‘-d DATESTR’
 ‘--date=DATESTR’
      Display the date and time specified in DATESTR instead of the
      current date and time.  DATESTR can be in almost any common format.
      It can contain month names, time zones, ‘am’ and ‘pm’, ‘yesterday’,
      etc.  For example, ‘--date="2004-02-27 14:19:13.489392193 +0530"’
      specifies the instant of time that is 489,392,193 nanoseconds after
      February 27, 2004 at 2:19:13 PM in a time zone that is 5 hours and
      30 minutes east of UTC.
      Note: input currently must be in locale independent format.  E.g.,
      the LC_TIME=C below is needed to print back the correct date in
      many locales:
           date -d "$(LC_TIME=C date)"
      *Note Date input formats::.

The "locale independent format" looks to be the problem in the above
to me.  But I think that is only your command line test as that is
different from what I see in the tzdata postinst.

This is where I rant that the entire -d interface should be officially deprecated because it is so broken, and replaced with something reliable that doesn't implement a confusing mess of kinda-NLP.
env TZ=Europe/London LC_ALL=C date -d "Sun Mar 27 00:59:00 UTC 2016"
Sun Mar 27 00:59:00 GMT 2016
env TZ=Europe/London LC_ALL=C date -d "Sun Mar 27 01:00:00 UTC 2016"
date: invalid date 'Sun Mar 27 01:00:00 UTC 2016'
env TZ=US/Eastern LC_ALL=C date -d "Sun Mar 27 01:00:00 UTC 2016"
Sat Mar 26 21:00:00 EDT 2016

Seems broken to me...

Mike Stone

Reply via email to