[CentOS] Trouble using date function in centos

Thomas Johansson thomasj at isy.liu.se
Sat Oct 4 19:48:28 UTC 2008


Is there someone that can explain why I get incorrect results on centos 
4.6 and 4.7 but not on centos 5.2??

The date "2008-10-26 +1 days" should results in 2008-10-27

On centos 4.6
--------------
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
test000:/% uname -a
Linux test000... 2.6.9-67.ELsmp #1 SMP Fri Nov 16 12:48:03 EST 2007 i686 
i686 i386 GNU/Linux

On centos 4.7
--------------
test001:/% date -d "2008-10-25 +1 days" "+%Y-%m-%d"
2008-10-26
test001:/% date -d "2008-10-26 +1 days" "+%Y-%m-%d"
2008-10-26
test001:/% uname -a
Linux test001... 2.6.9-78.0.1.ELsmp #1 SMP Tue Aug 5 11:02:47 EDT 2008 
i686 athlon i386 GNU/Linux

On centos 5.2
--------------
test002:/% date -d "2008-10-26 +1 days" "+%Y-%m-%d"
2008-10-27
test002:/% uname -a
Linux test002... 2.6.18-92.1.10.el5 #1 SMP Tue Aug 5 07:42:41 EDT 2008 
x86_64 x86_64 x86_64 GNU/Linux


More information about the CentOS mailing list