Zefram schreef:
> Sounds like you're looking for the equinox and solstice dates.  I don't
> see any CPAN module providing this, on search.cpan.org.

Take a look at the DateTime::Util::Astro modules. solar_longitude_before
and _after are useful to look for equinoxes and solstices, but you don't
need those to determine the season.

I would guess that something like

  use DateTime::Util::Astro::Sun;

  my $dt = DateTime->now;
  my $sl = DateTime::Util::Astro::Sun::solar_longitude($dt);

  if ($sl < 90) {
    print 'spring';
  } elsif ($sl < 180) {
    print 'summer';
  } elsif ($sl < 270) {
    print 'autumn';
  } else {
    print 'winter';
  }

would work (for the Northern Hemisphere).

Eugene

Reply via email to