Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

BusinessHours
An object that calculates business days and hours

BusinessHours - An object that calculates business days and hours


NAME

BusinessHours - An object that calculates business days and hours


SYNOPSIS


  use BusinessHours;

  use DateTime;

  my $datetime1=DateTime->new(year=>2007,month=>10,day=>15);

  my $datetime2 = DateTime->now;

  my $testing = BusinessHours->new(datetime1=>$datetime1,

                                  datetime2=>$datetime2,

                                  worktiming=>[9,18], # 9 am to 6 om

                                  weekends=>[6,7], #saturday , sunday

                                  holidays=>["2007-10-31",2007-12-24]

                                  holidayfile=>'holidaylist' #holidaylist is a text file 

                                                             #with each date in a new line

                                                             #in the format yyyy-mm-dd  

                                 );

  print $testing->getdays."\n"; # the total business days

  print $testing->gethours; # the total business hours


DESCRIPTION

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.


USAGE

Create an instance of the class with the two required datetime objects. and use the methods to get the business hours or days.

Constructors

  • new( ... )
  • This class method accepts the following parameters in the hash format.
    
                datetime1    =>  Starting Date 
    
                datetime2    =>  Ending Date
    
                worktimings  =>  A list reference with two values.Starting and ending hour of the day.
    
                                 Defaults to [9,18] 
    
                weekends     =>  A list reference with values of the days that must be considered 
    
                                 as non-working in a week.Defaults to [6,7] - Saturday , Sunday.
    
                holidays     =>  A list reference with holiday dates.
    
                holidayfile  =>  The name of a file from which predefined holidays can be excluded
    
                                 from business days /hours calculation. Defaults to no file.

Methods

This class has two methods.

  • getdays
  • Returns the number of business days

  • gethours
  • Returns the number of business hours.


AUTHOR

Antano Solar John


COPYRIGHT

Copyright (c) 2007 Antano Solar John. All rights reserved. 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.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy