Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 ( #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
Node Status?
node history
Node Type: note [id://298820]
help
Chatterbox?
[LanX]: unusual that "Pimp my Bride" never made it into TV (?)
LanX sighs ... no idea stupid enough
[choroba]: "Smack My Bitch Up" did, though
[Eily]: that's the internet for you LanX
[Eily]: and I'm pretty sure there's a rule somewhere that states that the stupider the idea, the more likely it is to already have been done
zentara is thinking of moving to Mars to esacpe it all

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (14)
As of 2017-03-27 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.