Hi. use Time::Local; %months = qw/Jan 1 Feb 2 Mar 3/; # etc. ($day, $mon, $yr) = split/-/, "5-Feb-09"; ##$time = timelocal($sec,$min,$hour,$mday,$mon,$year); see perldoc Time::Local $time = timelocal(0,0,0,$day,$months{$mon} - 1, $yr + 100); $now = time(); $diff = $now - $time; print "now $now, time $time, diff $diff\n"; printf "Days from then to now is %s", int ($diff / 86400);
To see if something's installed do perldoc Package::Name. Also try ppm. HTH. At 11:38 PM 2/24/2009 +0530, Perl Perl wrote: >Dear All, > > I have to compare two dates. And populate the result based on that. >First date I have received from previous script, which in this form >5-Feb-09. >And I have to compare this date with current date, locatime() . With the >localtime() I will get the current Day (24),Month (2) & year (2009 ) > >I will split the old date as below and get the result as below. > >$Old_Day = 5; >$Old_Month = Feb. > >And then I convert Feb to 2 ( Month number ) by using scalar veriable. ( The >thing repeated for all months ). > -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 00000100 _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs