At 12:54 AM 3/16/02 -0500, Eric Beaudoin wrote: >Hi everyone, > >I'm working on a script that will compile statistics for helpdesk tickets. >To compute these stats, I need to be able count the number of "business >hours" between the opening and the resolution of tickets. The working >hours are 08:00 to 17:00 so a ticket opened on Monday at 16:00 and closed >at Wednesday at 10:00 took 11 hours to solve. Weekends and holydays are off. > >Before going to the trouble of writing functions that will deal with dates >in this fashion, I was wondering if anybody knew either a simple way to do >it or a module that would deal with it. I browsed the CPAN's Date and Time >modules (there are lots of them) and couldn't find anything doing what I >wanted. I thought I would ask here if anybody had pointers for me.
Date::Manip will do this. http://search.cpan.org/doc/SBECK/DateManip-5.40/Manip.pod: For example, if a config file defines the workday as 08:00 to 18:00, a work week consisting of Mon-Sat, and the standard (American) holidays, then from Tuesday at 12:00 to the following Monday at 14:00 is 5 days and 2 hours. If the "end" of the day is reached in a calculation, it automatically switches to the next day. So, Tuesday at 12:00 plus 6 hours is Wednesday at 08:00 (provided Wed is not a holiday). Also, a date that is not during a workday automatically becomes the start of the next workday. So, Sunday 12:00 and Monday at 03:00 both automatically becomes Monday at 08:00 (provided Monday is not a holiday). In business mode, any combination of date and delta may be entered, but a delta should not contain a year or month field (weeks are fine though). [...] If $mode is 3 (which only applies when two dates are passed in), an exact business mode is used. In this case, it returns a delta as an exact number of business days/hours/etc. between the two. Weeks, months, and years are ignored. Disclaimer: I haven't actually tried this. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]