On Nov 15, Adam Turoff said:

>Find the first day of the next month (remember december/january rollover)
>and subtract one day:

>  my ($mon, $year) = (11, 2001);
>  my $first = timelocal(0,0,0, 1, $mon % 12, ($year-1900 + int($mon/12)));

You'll probably want to use noon if you're going to subtract days.  It's
safer in general, and I should have done it to begin with.  And I'd use

  $mon == 12

instead of

  int($mon/12)

because it's a bit less obfuscated.  Then again, you probably don't even
NEED the int() there.

-- 
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