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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Calculation

Status
Not open for further replies.

wehttam

Technical User
Nov 11, 2002
8
0
0
US
Sorry, I usually search before posting, but the keyword search is "down" right now for maintenance.

Given that the following example assigns the current date to the variable TEST (in the format mm/dd/yy)...
# TEST=`date +%D`
# echo $TEST
01/16/03


What is the calculation that will assign the date of one week ago (7 days ago) in the format mm/dd/yy?

Thanks!
 
Use a different offset in TZ, ie, I am on GMT+1, so to get last week is (7 * 24) +1

#!/bin/ksh
TZ=CUT169
TEST=$(date +%D)
print ${TEST}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top