Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Calculate down time of devices in prime time (only working hours, excluding p_holidays)

by phydeauxarff (Priest)
on Oct 13, 2003 at 12:27 UTC ( [id://298820]=note: print w/replies, xml ) Need Help??


in reply to Calculate down time of devices in prime time (only working hours, excluding p_holidays)

I just recently needed a similar report of business days that have passed for reporting and finally found date::calendar

The following is an example of taking two days and figuring out the delta of business days.

#!/usr/bin/perl use strict; use Date::Calendar; my $date_1 = [2003,9,24]; my $date_2 = [2003,10,9]; my $flag_1 = '1'; my $flag_2 = '0'; my $calendar = Date::Calendar->new({}); my $days = $calendar->delta_workdays($date_1,$date_2,$flag_1,$flag_2); print "$days\n";

There is also the ability to build your holiday list as well.

There is also Date::Business but I haven't given that a shot yet.

  • Comment on Re: Calculate down time of devices in prime time (only working hours, excluding p_holidays)
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://298820]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found