I want to get previous date from date command. I am using ksh shell.
Exmp:
today is 2008.09.04
I want the result : 2008.09.03
Please help.
Thanks in advance.
I want to get previous date from date command. I am using ksh shell.
Exmp:
today is 2008.09.04
I want the result : 2008.09.03
Please help.
Thanks in advance.
$ date +%F
2008-09-04
$ date +%F -d '-1 day'
2008-09-03
$ date +%F
2008-09-04
$ date +%F -d '-1 day'
2008-09-03
This code return the Month name(September) not "2008-09-03".
Which OS ? Check if date(1) supports -d flag in man page.
If your version of ksh is actually ksh93, then the following works
$ printf "%(%Y.%m.%d)T\n" "yesterday"
2008.09.03
$