in reply to Re: Re: Re: Re: Calculating between times
in thread Calculating between times

If you can afford using a module, I recommend Date::Calc. It has a check_date function that can check if any date is valid, and also a Days_in_Month function that returns the number of days in a given month.

I also recommend Date::Calc for any date/time calculations. IMHO, date/time calculations is one of those things that has been done too many times, but is always a source of errors when you try to do it yourself... From converting seconds to hours, to adding days to a date while taking into account the leap year calculations and everything, this module can simplify error-prone date/time calculations greatly.

(Geez, that sounds like a sales pitch... I'm serious about those types of calculations being error prone though. Just go through Date::Calc's POD, you'll see how many things the author took into account in the module)
  • Comment on Re: Re: Re: Re: Re: Calculating between times