Time::Business - Business Time Between Two Times
use Time::Business; my $btime = Time::Business->new({ WORKDAYS => [1,2,3,4,5], STARTTIME => '9:00', STOPTIME => '17:00', }); $begin=time(); $end=time()+86400; $seconds = $btime->calctime($begin,$end);
Calculates the number of business seconds between two dates (specified in epoch seconds) given a list of working days and start and end times.
Setup a Time::Business object, passing the working time parameters. eg.
my $btime = Time::Business->new({ WORKDAYS => [1,2,3,4,5], STARTTIME => '9:00', STOPTIME => '17:00', });
where WORKDAYS is specified as a list of 0..6 where Sun is 0 and Sat is 6.
Returns the number of business seconds between $begin and $end (seconds since epoch) given the parameters specified in the Time::Business->new.
Converts the $seconds given to a string of the form "n days n hours n minutes". NOTE: This conversion is based on business hours so one day is one working day, not one 24 hour day. Useful for reports etc.
David Peters CPAN ID: DAVIDP davidp@electronf.com http://www.electronf.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).
To install Time::Business, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Business
CPAN shell
perl -MCPAN -e shell install Time::Business
For more information on module installation, please visit the detailed CPAN module installation guide.