Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get last 7 days from today?

Status
Not open for further replies.

volcano

Programmer
Aug 29, 2000
136
HK
Hi I would like to get last 7 days starting from today and then store them into an array. For example today is 2 March 2004, my wanted values would be 24, 25, 26, 27, 28, 29 Feb and 1 Mar. How should I write the code? I know that to get yesterday's date, I can write the code as below:

TZ="$TZ+24"
export TZ
YESTERDAY=`date +%Y%m%d`

I tried TZ="$TZ+48" and so forth, but it failed. Thanks for your help!

Volcano
 
Take a look at my faq: faq80-4800

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Your script has solved my problem yet. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top