On Jul 22, Steve Howard said:

>Have you installed and DATE::CALC. If so you would do something like
>this:
>
>my $dd = Delta_Days(@th{year, mon, mday}, @expiatory);

I far prefer the simpler (and standard-module) approach of the Time::Local
module.  This module is a tool you should get to know well.

  use Time::Local;

  my ($bd, $bm, $by) = (9, 11, 1981);      # my birthday
  my ($nd, $nm, $ny) = (localtime)[3..5];  # today

  my $start = timelocal(0,0,12, $bd, $bm-1, $by-1900);  # noon of b'day
  my $end = timelocal(0,0,12, $nd, $nm, $ny);           # noon today

  my $sec_diff = $end - $start;
  my $day_diff = int( $sec_diff / 86400 );

  print "I am $day_diff days old!\n";

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734
**      Manning Publications, Co, is publishing my Perl Regex book      **



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

Reply via email to