On Thu, 6 Apr 2006, hridyesh pant wrote:

> Hi,
> i have two date string reading from the log file like below.
> $date1="Mon Mar 27 02:45:15 2006";
> $date2="Wed Apr  5 23:20:46 2006";
> 
> $Number_of_Days = $date1-$date2;
> i want to get number of days between these two dates.
> Can someone help me.


I think the best way to do this is to use Date::Calc

use Date::Calc qw(Delta_Days);
@date1 = (2006, 3, 27);
@date2 = (2006, 4, 5);

$diff = Delta_Days(@date1, @date2);


You of course will have to parse the raw dates to get the tear, month and
day



Owen 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to