[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: date fails to parse seconds and nanoseconds

From: Pádraig Brady
Subject: Re: date fails to parse seconds and nanoseconds
Date: Mon, 09 Jun 2014 18:49:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 06/09/2014 06:35 PM, Kasza Péter wrote:
> Date can't seem to parse seconds (or nanoseconds) when they are
> immedately after another term. E.g. trying to parse the string
> "20140609T150610" (2014-06-09-15:06:10) fails.
>> % date +%Y%m%dT%H%M%S  -d "20140609T150610"
>> date: invalid date ‘20140609T150610’
> The date parses correctly, if the seconds are removed:
>> % date +%Y%m%dT%H%M%S  -d "20140609T1506"
>> 20140609T100600
> Using the output from the previous command also gives an error:
>> % date +%Y%m%dT%H%M%S  -d "20140609T150600"
>> date: invalid date ‘20140609T150600’
> Is this a bug or am I doing something the wrong way?

Well it's documented as such in:

I guess not supporting seconds here avoids ambiguities as to whether you're
referring to a date or a time.

A proposal I saw recently was for date to support specifying
an input format for precise control like this, like FreeBSD supports:

  BSD> date -j -f "%H%M%S" "010203"
  Mon Jun  9 01:02:03 GMT 2014

  GNU> date -d '010203'
  Sat Feb  3 00:00:00 GMT 2001


reply via email to

[Prev in Thread] Current Thread [Next in Thread]