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

find number of days between 2 dates

Status
Not open for further replies.

kasavazala

Programmer
Jul 25, 2003
7
US
Hi,

I want to find number of days between two given dates using perl.

thanks in advance
 
use Date::Calc qw(Delta_Days);
@bree = (1981, 6, 16); # 16 Jun 1981
@nat = (1973, 1, 18); # 18 Jan 1973
$difference = Delta_Days(@nat, @bree);
print "There were $difference days between Nat and Bree\n";
There were 3071 days between Nat and Bree

Hope this works for you!

X
 
What format are your dates in?
--Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top