i need a script that can tell me the date 2 days ago or 3 days ago.
please help
i need a script that can tell me the date 2 days ago or 3 days ago.
please help
Check out Perderabo's post.
http://www.unix.com/answers-frequently-asked-questions/13785-yesterdays-date-date-arithmetic.html
what have you tried till now??
give it a try if you can't do it get back here we will definately help you out..
when i use datecalc like
datecalc - a 2009 05 31 - 2
i get 2009 5 29
but i want the results in the format
yyyymmdd
i.e 2009 05 29.
As a workaround, instead of changing the datecalc script, you can pipe the output to awk:
awk '{printf("%s %02d %02d\n",$1,$2,$3)}'
once you get it pass it to awk and get the desired o/p
echo "2009 5 24"|awk '{printf "%s %02s %02s",$1,$2,$3}'
it worked perfectly thanks
Using ksh93
$ printf "%T\n" "2 days ago"
Sun May 31 09:11:17 EDT 2009
$ printf "%(%D)T\n" "3 days ago"
05/30/09