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

dates

Status
Not open for further replies.

abovebrd

IS-IT--Management
May 9, 2000
690
US
I need to add two entires to a data file. These entires are the present date and (the date that would be two weeks back from the present date)

In other words

todays date - 14 days
If todays date was 1/3/01
The second date would need to be 12/20/00

These entries get appened to a file.
I figured out how to create the first date.
date +%D > date.new

Any ideas on how to create the second date ?

Would perl be a good soloution for this ?

-Danny






 
try checking some of the date modules on cpan, they might have something there. adam@aauser.com
 
# seconds since 1970
$time = time;

# today
($second,$minute,$hour,$day,$month,$year,$wday,$yday,$isdst) = localtime($time);

# two weeks ago
$before = $time - 1209600;

($second,$minute,$hour,$day,$month,$year,$wday,$yday,$isdst) = localtime($before);
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top