i have 2 dates in mm/dd/yyyy format and i need to find the number of days in
between them. i have googled both the web and the ruby newsgroup and haven't
found anything that addresses this.
for what it's worth, this is what the perl code looks like that i am trying to
convert to ruby :
#!/usr/bin/perl
use Time::Local ; # for days_between subroutine
···
###################################################
# return the absolute value of the difference between two dates
sub days_between {
my $first_date = $_[0] ;
my $second_date = $_[1] ;
my ($month1, $day1, $year1) = (split /\//, $first_date) ;
my ($month2, $day2, $year2) = (split /\//, $second_date) ;
my $date1 = timelocal 0, 0, 0, $day1, $month1 - 1, $year1 - 1900 ;
my $date2 = timelocal 0, 0, 0, $day2, $month2 - 1, $year2 - 1900 ;
return abs(($date2 - $date1) / 86400) ; # the number of seconds in a day
}
###################################################
thanks
joe