"date -d '-X day' returning wrong day around StandardTime/DaylightTime c
From:
Philip Zimmerman (phzimmer)
Subject:
"date -d '-X day' returning wrong day around StandardTime/DaylightTime change-over
Date:
Thu, 12 Mar 2009 11:10:06 -0400
Hello,
I've noticed a behavior of the 'date' utility as a result of the DST
change-over, and was wondering whether this is "expected behavior" or whether
this is a problem, so I'm inquiring whether anyone else has noticed this.
During the StandardTime-DaylightTime changeover, the timeZone was correctly
changed and the time reported by 'date' was correct during the change-over,
however, it seems to be reporting the wrong day when using syntax to produce a
date string using 'date -d '-X day' +%m/%d/%Y', where X is the number of days
behind the change-over from Standard Time to Daylight Savings.
i.e. For the EST to EDT changeover, If the current time is set to Monday Mar
9th, 00:30, then:
date -d '-0 day' +%m/%d/%Y reports 03/09/2009 (as it should)
date -d '-1 day' +%m/%d/%Y reports 03/07/2009 (one day off)
If I set the time to Monday Mar 9th, 01:30 hours and do the same calculation,
then it reports the correct day on both calculations.
Tks -- pz