
Business::Hours - Calculate business hours in a time period

use Business::Hours; my $hours = Business::Hours->new(); # Get a Set::IntSpan of all the business hours in the next week. # use the default business hours of 9am to 6pm localtime. $hours->business_hours_in_timespan(Start => time(), End => time()+(86400*7));

This module is a simple tool for calculating business hours in a time period. Over time, additional functionality will be added to make it easy to calculate the number of business hours between arbitrary dates.


Yes

Send email to bug-business-hours@rt.cpan.org

Jesse Vincent
Best Practical Solutions, LLC
jesse@cpan.org
http://www.bestpractical.com

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.

perl(1).
Creates a new Business::Hours object. Takes no arguments.
Set the business hours for this Business::Hours object. Takes a hash of the form :
{ 0 => { Name => 'Sunday', Start => 'HH:MM', End => 'HH:MM'},
1 => { Name => 'Monday',
Start => 'HH:MM',
End => 'HH:MM'},
....
6 => { Name => 'Saturday',
Start => 'HH:MM',
End => 'HH:MM'},
};
Start and end times are of the form HH:MM. Valid times are
from 00:00 to 23:59. If your hours are from 9am to 6pm, use
Start => '9:00', End => '18:00'. A given day MUST have a start
and end time OR may declare both Start and End to be undef, if
there are no valid hours on that day.
Note that the ending time is really "what is the first minute we're closed.
If you specifiy an "End" of 18:00, that means that at 6pm, you are closed.
The last business second was 17:59:59.
Takes a paramhash with the following parameters
Start => The start of the period in question in seconds since the epoch
End => The end of the period in question in seconds since the epoch
Returns a Set::IntSpan of business hours for this period of time.
Returns the number of business seconds between START and END Both Start and End should be specified in Seconds since the Epoch
Returns -1 if Start or End is outside the calculated business hours
Returns START if START is within business hours. Otherwise, returns the next business second after START. START should be specified in Seconds since the Epoch. If it can't find any business hours within thirty days, returns -1.
Returns a time SECONDS business seconds after START. START should be specified in Seconds since the Epoch. If it can't find any business hours within thirty days, returns -1.