DateTime::BusinessHours - An object that calculates business days and hours
my $d1 = DateTime->new( year => 2007, month => 10, day => 15 ); my $d2 = DateTime->now; my $test = DateTime:::BusinessHours->new( datetime1 => $d1, datetime2 => $d2, worktiming => [ 9, 17 ], # 9am to 5pm # lunch from 12 to 1 # worktiming => [ [ 9, 12 ], [ 13, 17 ] ], weekends => [ 6, 7 ], # Saturday and Sunday holidays => [ '2007-10-31', '2007-12-24' ], holidayfile => 'holidays.txt' # holidayfile is a text file with each date in a new line # in the format yyyy-mm-dd ); # total business hours print $test->gethours, "\n"; # total business days, based on the number of business hours in a day print $test->getdays, "\n";
BusinessHours a class for caculating the business hours between two DateTime objects. It can be useful in situations like escalation where an action has to happen after a certain number of business hours.
This class method accepts the following arguments as parameters:
This will force a recalculation of the business hours and days. useful if you've changed any values (datetime1, datetime2, worktiming, etc) or updated the holiday file
Returns the number of business days
Returns the number of business hours.
To install this module, run the following commands:
perl Makefile.PL make make test make install
After installing, you can find documentation for this module with the perldoc command.
You can also look for information at:
RT, CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=DateTime-BusinessHours AnnoCPAN, Annotated CPAN documentation http://annocpan.org/dist/DateTime-BusinessHours CPAN Ratings http://cpanratings.perl.org/d/DateTime-BusinessHours Search CPAN http://search.cpan.org/dist/DateTime-BusinessHours
Antano Solar John <firstname.lastname@example.org>
Brian Cassidy <email@example.com>
Copyright (c) 2007-2011 Antano Solar John, 2012-2013 by Brian Cassidy
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.