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

Get the date before 90 days? 1

Status
Not open for further replies.

inetd

Technical User
Jan 23, 2002
115
HK
I want to write a shell script to get the date before 90 days. How can I do it? I would like to have the yyyy-mm-dd format. Anyone knows how to do it?

Thanks.
 
hi,
just try

#!/usr/bin/perl
@old_date=localtime(time()-90*24*60*60);
$old_date[5]+=1900;
print $old_date[5]." - ".$old_date[4]." - ".$old_date[3];


read time() and localtime() functions manual


PM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top