If your system has GNU date installed, you can perform some very cool and quick date arithmetic with the -d option. For example:
|
1 2 3 4 5 6 7 8 9 10 11 |
$ # get yesterdays date and format the output $ date -d "yesterday" +"%d %b %Y" 10 Jan 2005 $ # get the date in two mondays time $ date -d "next 2 monday" Mon Jan 17 00:00:00 GMTST 2005 $ # 3 weeks ago $ date -d "3 weeks ago" Wed Dec 20 14:06:44 GMTST 2004 |
You get the idea. Read the man and info pages for date for further information!