Stephen Harris wrote:
On Sat, Oct 04, 2008 at 09:48:28PM +0200, Thomas Johansson wrote:
Is there someone that can explain why I get incorrect results on centos 4.6 and 4.7 but not on centos 5.2??
test000:/% date -d "2008-10-25 +1 days" "+%Y-%m-%d" 2008-10-26 test000:/% date -d "2008-10-26 +1 days" "+%Y-%m-%d" 2008-10-26
My initial immediate guess would be daylight savings related; if in your timezone the clock goes back on the 26th then 2008-10-26 (which means 00:00) + 24 hours would only be 2008-10-26 23:00.
That was my problem. Became confused when i got different behavior on centos 4 and centos 5. Problem solved! Thank you!
To avoid that kind of trouble i moved to perl for the date functionality in my script. That solution is also more portable across my different *nix platforms.