求教,如何能过得到的2个时间段计数之间的天数?

求教,如何能过得到的2个时间段计数之间的天数?

求教,如何能过得到的2个时间段计数之间的天数?
如有2个字串,分别是
$a = "2006-01-22 22:12:00";
$b = "2006-03-15 01:03:30";

如何计算$a 与 $b 之间的天数?

$day = time; 或 $day = 282345;
$day 如何换算成具体的天数?
use Time::Local ;--$a .
use Time::Local ;
$a = "2006-01-22 22:12:00";
$b = "2006-03-15 01:03:30";

print int ((&gettime ($b) - &gettime ($a)) / 86400);

sub gettime ($)
{
my ($year, $mon, $mday, $hour, $min, $sec) = split (/\-|\ |\:/, $_[0]);
timelocal ($sec, $min, $hour, $mday, $mon - 1, $year - 1900);
}
[quote]--#!/usr/bin/pe.
[quote]
#!/usr/bin/perl
# cnhacktnt [ at ] perlchina.org

use Date::Calc qw/Delta_DHMS/;

@t1=(2006,01,22,22,12,00);
@t2=(2006,03,15,01,03,30);
printf( "%d Days,%d Hours,%d Minutes,%d Seconds", Delta_DHMS(@t1,@t2) );
[/quote]
请参见:
http://www.unix.org.ua/orelly/perl/cookbook/ch03_06.htm
http://datetime.perl.org/
谢谢楼上2位达人~~~~.