Bob Proulx wrote: > 李嘉鹏 wrote: > > I used some script(At the end of the letter) to get a series of > > date. but the script always fails at the date 1991-04-14. so I > > tested the single command > > date -d '1991-04-14 +1 day' > > It would also fail with a error message > > date: invalid date `1991-04-14 +1 day' > > displayed. > > Thank you for the bug report. However I am unable to reproduce it. > Therefore I conclude that the problem must be related to your > timezone. Because you are taking dates a midnight I am guessing that > there is very likely a daylight savings time issue there. (Was > Daylight Savings Time active then?) Instead, try looking at dates at > noon. > > date -d '1991-04-14 12:00 +1 day'
Using Asia/Chongqing timezone shows that DST was active at that time. $ zdump -v Asia/Chongqing | grep 1991 Asia/Chongqing Sat Apr 13 15:59:59 1991 UTC = Sat Apr 13 23:59:59 1991 CST isdst=0 gmtoff=28800 Asia/Chongqing Sat Apr 13 16:00:00 1991 UTC = Sun Apr 14 01:00:00 1991 CDT isdst=1 gmtoff=32400 Asia/Chongqing Sat Sep 14 14:59:59 1991 UTC = Sat Sep 14 23:59:59 1991 CDT isdst=1 gmtoff=32400 Asia/Chongqing Sat Sep 14 15:00:00 1991 UTC = Sat Sep 14 23:00:00 1991 CST isdst=0 gmtoff=28800 There was no 1991-04-14 00:00:00 since the time progressed to Apr 14 01:00:00 with the next clock tick. Because 1991-04-14 00:00:00 does not exist 'date' returns an invalid date error for it. Using the time at noon would avoid these problems. Also using time in UTC avoids all daylight savings time issues. Bob