bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] lib/parse-datetime.y: Add ability to parse output of GNU dat


From: Bruce Korb
Subject: Re: [PATCH] lib/parse-datetime.y: Add ability to parse output of GNU date(1)
Date: Wed, 04 Feb 2015 09:25:12 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 02/02/15 09:27, Pádraig Brady wrote:
On 02/02/15 16:41, Chris Lamb wrote:
We are currently in a funny situation where GNU date can't parse its own
output:

   $ date --date="$(date)"
   date: invalid date ‘Mon  2 Feb 16:37:46 GMT 2015’

I don't think this will work as the output from date(1) is ambiguous.
For example locales change change the output order, and names.
In your example, date(1) can parse US locale default format, but not UK:

$ date -d"$(LC_TIME=en_GB date)"
date: invalid date ‘Mon  2 Feb 17:23:25 GMT 2015’

It would still be useful to make the ways for doing this more readily known.
e.g. in examples:

  touch -t $(date --date @$(( $(date +%s) + 10 )) +%Y%m%d%H%M.%S) file

set the modify time of "file" to 10 seconds from now.  It's a little obtuse.



reply via email to

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