On Nov 15, Glenn Cannon said:

>Given the month and the year, how can I derive what day the first landed on?

Using the standard Time::Local module, and the built-in
localtime() function.

  use Time::Local;
  use strict;

  my ($mon, $year) = (11, 2001);
  my $first = timelocal(0,0,0, 1, $mon-1, $year-1900);

  my $dow = (localtime $first)[6];
  my $day = (qw( Sun Mon Tues Wednes Thurs Fri Satur ))[$dow] . "day";

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **


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

Reply via email to