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.
Those timestamps do not exist because your local daylight savings time skipped over that hour. Those times never existed in your timezone. You didn't say what timezone you were using but for discussion I will assume one. $ zdump -v Europe/Berlin | grep 2009 Europe/Berlin Sun Mar 29 00:59:59 2009 UTC = Sun Mar 29 01:59:59 2009 CET isdst=0 gmtoff=3600 Europe/Berlin Sun Mar 29 01:00:00 2009 UTC = Sun Mar 29 03:00:00 2009 CEST isdst=1 gmtoff=7200 As you can see there was no 2 hour then. It skipped from 01:59:59 to 03:00:00. Please see this reference for more information: http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e Bob
