1Business::Hours(3)    User Contributed Perl Documentation   Business::Hours(3)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

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

USAGE

BUGS

22       Yes
23

SUPPORT

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

AUTHOR

28           Jesse Vincent
29           Best Practical Solutions, LLC
30           jesse@cpan.org
31           http://www.bestpractical.com
32
34       This program is free software; you can redistribute it and/or modify it
35       under the same terms as Perl itself.
36
37       The full text of the license can be found in the LICENSE file included
38       with this module.
39

SEE ALSO

41       perl(1).
42
43       new
44
45       Creates a new Business::Hours object.  Takes no arguments.
46
47       business_hours
48
49       Set the business hours for this Business::Hours object.  Takes a hash
50       of the form :
51
52       {
53           0 => { Name => 'Sunday',
54                   Start => 'HH:MM',
55                      End => 'HH:MM'},
56
57           1 => { Name => 'Monday',
58                   Start => 'HH:MM',
59                      End => 'HH:MM'},
60           ....
61
62           6 => { Name => 'Saturday',
63                   Start => 'HH:MM',
64                      End => 'HH:MM'},
65           };
66
67           Start and end times are of the form HH:MM.  Valid times are
68           from 00:00 to 23:59.  If your hours are from 9am to 6pm, use
69           Start => '9:00', End => '18:00'.  A given day MUST have a start
70           and end time OR may declare both Start and End to be undef, if
71           there are no valid hours on that day.
72
73           Note that the ending time is really "what is the first minute we're closed.
74           If you specifiy an "End" of 18:00, that means that at 6pm, you are closed.
75           The last business second was 17:59:59.
76
77       for_timespan
78
79       Takes a paramhash with the following parameters
80
81               Start => The start of the period in question in seconds since the epoch
82               End => The end of the period in question in seconds since the epoch
83
84       Returns a Set::IntSpan of business hours for this period of time.
85
86       between START, END
87
88       Returns the number of business seconds between START and END Both Start
89       and End should be specified in Seconds since the Epoch
90
91       Returns -1 if Start or End is outside the calculated business hours
92
93       first_after START
94
95       Returns START if START is within business hours.  Otherwise, returns
96       the next business second after START.  START should be specified in
97       Seconds since the Epoch.  If it can't find any business hours within
98       thirty days, returns -1.
99
100       add_seconds START, SECONDS
101
102       Returns a time SECONDS business seconds after START.  START should be
103       specified in Seconds since the Epoch.  If it can't find any business
104       hours within thirty days, returns -1.
105
106
107
108perl v5.8.8                       2005-07-08                Business::Hours(3)
Impressum