> -----Original Message-----
> From: Clinton [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 30, 2001 10:07 PM
> To: [EMAIL PROTECTED]
> Subject: Date_to_Text Problem
> 
> 
> I have separated Year, Month and Day so I can feed into the 
> Date_to_Text
> function from Calc.
> 
> $firstdate = $dates[1];
> $firstdate =~m/(\d*)-0?(\d*)-0?(\d*)/g;
> my $year = $1;
> my $month = $2;
> my $day = $3;
> 
> If I print $firstdate it correctly prints 2001-07-16 00:00:00
> However
> my $firstcalc = Date_to_Text($year,$month,$day);
> reports an error
> Date::Calc::Date_To_Text not a valid date.

The following test script:

   use Date::Calc qw(Date_to_Text);

   $firstdate = '2001-07-16 00:00:00';
   $firstdate =~m/(\d*)-0?(\d*)-0?(\d*)/;
   print "$1, $2, $3\n";
   my $year = $1;
   my $month = $2;
   my $day = $3;
   print Date_to_Text($year, $month, $day), "\n";

produces the following output for me:

   2001, 7, 16
   Mon 16-Jul-2001

I removed the /g modifier, but the output was the same with it in.

You need to check the values of $1, $2, $3. $firstdate may *look*
right, but there may be something there keeping the regex from
matching.

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

Reply via email to