bash - Strange behavior for the date() function linux -
this question has answer here:
i have found strange behaviour date() function when using bash. when use date -d "2008-10-12 +1 days", date function returned
date: invalid date ‘2008-10-12 +1days’
even returned error when trying:
date -d "2008-10-12" --> date: invalid date ‘2008-10-12’
however, works for:
date -d "2008-10-13 +1days" --> tue oct 14 00:00:00 clst 2008
date -d "2008-10-11 +1days" --> sun oct 12 01:00:00 clst 2008
date -d "2007-10-12 +1days" --> sat oct 13 00:00:00 clt 2007
... , on
it seems date() not recognize "just" 2008-10-12. bug? doing wrong?
i using centos 7
all best
in rhel 7 there many changes happened somany commands. change time , date earlier used use date command , need use timedatectl command (preferred) instead.
http://www.freedesktop.org/software/systemd/man/timedatectl.html
so there new latest command more features included might have limited (not sure on that). version have been using timedatectl command great one.
Comments
Post a Comment