On Thu, 4 Feb 2010, Klaus Bramstedt wrote:

I used the command
date -d "$DATE"
for almost all dates between Aug 2002 end Jan 2010 in a script.
Date has a format like this
  "2003-03-30 02:08:17"
However, 7 of 42048 randomly distributed dates in the list failed:

date: ungültiges Datum „2003-03-30 02:08:17“
date: ungültiges Datum „2003-03-30 02:25:58“
date: ungültiges Datum „2005-03-27 02:08:41“
date: ungültiges Datum „2006-03-26 02:41:44“
date: ungültiges Datum „2008-03-30 02:08:09“
date: ungültiges Datum „2009-03-29 02:09:26“
date: ungültiges Datum „2007-03-25 02:03:47“

For me, this seems to be a bug in the date reading part. The critical combination seems to be end of March and '02' as hour.

You don't say which timezone you're using, but I'll guess Europe/Berlin, in which case this is a DST issue, but not a bug.

$ zdump -v Europe/Berlin  | grep 2003
Europe/Berlin  Sun Mar 30 00:59:59 2003 UTC = Sun Mar 30 01:59:59 2003 CET 
isdst=0 gmtoff=3600
Europe/Berlin  Sun Mar 30 01:00:00 2003 UTC = Sun Mar 30 03:00:00 2003 CEST 
isdst=1 gmtoff=7200
Europe/Berlin  Sun Oct 26 00:59:59 2003 UTC = Sun Oct 26 02:59:59 2003 CEST 
isdst=1 gmtoff=7200
Europe/Berlin  Sun Oct 26 01:00:00 2003 UTC = Sun Oct 26 02:00:00 2003 CET 
isdst=0 gmtoff=3600

According to the daylight saving rules there was a discontinuity from 01:59:59 -> 03:00:00 on the dates you gave above, at the start of DST.

Please see this entry in the coreutils FAQ:
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e


Cheers,
Phil


Reply via email to