On Thu, 2006-06-04 at 09:28 -0400, Brian Volk wrote: > > Excellent summary of most methods at > > http://perlmeme.org/faqs/datetime/comparing_dates.html. > > > > Regards > > > > James Turnbull > > Hi All, > > I'm running through the example of Date::Calc on the site listed above. > When I plug in today's date as my birthday... it returns: > > I am -31 days old. > > I would have guessed "0" days old. Can someone pls explain this to me? > > (localtime)[5,4,3] stands for [$year, $mon, $mday] correct? > > #!/usr/bin/perl > use strict; > use warnings; > use Date::Calc qw(Delta_Days); > > my @today = (localtime)[5,4,3]; > $today[0] += 1900;
$today[1] ++; # months go from 0 to 11 > > my @birthday = (2006, 4, 6); > > my $days = Delta_Days(@birthday, @today); > > print "I am $days days old\n"; > > exit 0; > > Thank you! > > Brian Volk > > > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>