Reputation: 707
The following works on my Ubuntu machine
$ date -d 2014-07-23T00:00Z
ons 23 jul 2014 02:00:00 CEST
While on another machine running centos I get
$ date -d 2014-07-23T00:00Z
date: invalid date `2014-07-23T00:00Z'
From running
date --version
I can see that the version of gnu coreutils are 8.21 on Ubuntu and 8.4 on the centos machine.
My question is this: Is it due to differences in date functionality that this happens, or does it have to do with somehing else (like the locale, which I have played with a bit without success)?
If it is due to differences in date functionality, where can I read about these updates?
Upvotes: 4
Views: 185
Reputation: 27822
From the NEWS
file:
* Noteworthy changes in release 8.13 (2011-09-08) [stable]
[..trim..]
** New features
date now accepts ISO 8601 date-time strings with "T" as the
separator. It has long parsed dates like "2004-02-29 16:21:42"
with a space between the date and time strings. Now it also parses
"2004-02-29T16:21:42" and fractional-second and time-zone-annotated
variants like "2004-02-29T16:21:42.333-07:00"
So, it's a feature available in GNU Coreutils 8.13 and newer.
This entry should also give you an answer on how to fix your string so that it works for both platforms :-)
Upvotes: 1