There are a number of different modules (Date::Calc or Date::Manip
as two possiblities) which you might use, but really depends on the format
of the dates coming in.  If you know they are pretty constant, then you
could use Time::Local:

use Time::Local;

my $Dates = '07/13/01 - 07/12/01';              # date in format you want
my @DateUse = ();                                       # hold the
information from getting month,day,year

while ( $Dates =~ /(\d{1,2}){1}/g ) {   #loop through getting numeric data
and placing in array
   printf "%-s\n",$1;                           # debug print
   push(@DateUse,$1);
 }
printf "%d\n", scalar(@DateUse);                # Debug print

if ( ! (scalar(@DateUse) and ! (scalar(@DateUse) % 6) ) ) { # should be in
groups of 6 to do calc
   die "Expecting groups of 6 for date calculations\n";
 }
 
for(my $MyId=0;$MyId<scalar(@DateUse);$MyId+=6) {
   my $t1 =
timelocal(0,0,0,$DateUse[$MyId+1],$DateUse[$MyId]-1,$DateUse[$MyId+2]); 
                # need to subtract 1 from month
                # timelocal is smart enough so whether you give it 01, 101
or 2001, it calcs correctly
                #
   my $t2 =
timelocal(0,0,0,$DateUse[$MyId+4],$DateUse[$MyId+3]-1,$DateUse[$MyId+5]);
   printf "t1: %9d  t2: %9d\n", $t1, $t2;
   my $tdiff = int(($t1 - $t2)/86400);  # subtract time and divide by
86400(# of secs in day)
   printf "Days: %3d\n", $tdiff;
}

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 13, 2001 12:17
To: [EMAIL PROTECTED]
Subject: date 


Hi,
Does anyone know how to get a difference between 2 dates. For instance
something like (07/12/01 - 07/13/01) that would get me 1.

Thanks in advance

I.S

__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at
http://webmail.netscape.com/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to