In one of my script, I need to find a 2 days back date from a given date. I have been using the below without any issue since long time, but it's just the first time I got a error which drilled down to wrong value by date command.
$ date -d 20140331" - 2 days" +%Y%m%d
Using "- 2 days" gives expected output, but still struggling to find why subtracting seconds didn't work?
Note: My process runs in middle of the day, and hence I don't see any extreme boundary condition like 1 sec got dwindled here and there.
Some more info
$ date --version date (GNU coreutils) 5.97 Copyright (C) 2006 Free Software Foundation, Inc.