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’ > > This is not aesthetically pleasing at the very least. > > Signed-off-by: Chris Lamb <ch...@chris-lamb.co.uk> > --- > lib/parse-datetime.y | 19 +++++++++++++++++-- > 1 file changed, 17 insertions(+), 2 deletions(-)
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’ $ date -d"$(LC_TIME=en_US date)" Mon Feb 2 17:23:35 GMT 2015 Also the timezone output is ambiguous depending on your location. See http://www.pixelbeat.org/docs/linux_timezones/ I think the best we could offer is formats to guide parsing: http://lists.gnu.org/archive/html/coreutils/2014-06/msg00034.html thanks, Pádraig.