in reply to unable to see entries from 1st day of the month.

Right off the bat I see some big problems.

if ($currentyear % 4) { $next = $leapdays{$currentmonth} - $currentday + 1 + $param{jumpto}; } else { $next = $nonleapdays{$currentmonth} - $currentday + 1 + $param +{jumpto}; }

This is wrong, leap years have 2 more rules associated with them.

  • If the year is divisible by 4, it is a leap year, UNLESS
  • The year is also divisible by 100, then it's not a leap year, UNLESS
  • The year is also divisible by 400, then it is a leap year
  • Anytime I think to myself someone has probably done this (leap years and date manipulation) before, I think, 'I should look on CPAN'. One CPAN module you'll find is Date::Calc you should run and grab this.

    It's not a hard module to use and I guarentee you'll have your problem (plus others) fixed if you implement it.



    grep
    grep> cd /pub
    grep> more beer

    Replies are listed 'Best First'.
    Re: Re: unable to see entries from 1st day of the month.
    by mnlight (Scribe) on Mar 28, 2002 at 19:30 UTC
      I have installed Date::Pcalc module which is an all perl version of the Date::Calc. Now could you give me an idea as to how I would use it in this code.