Hi, Thanks a lot for posting your code. I had similar problem in which I wanted the number of working days between two dates taking holidays also into account. I referred your code and modified it as per my script.Using Date::Calendar and reading data from custom file. My file is :
# cat /home/otrsvpn/holiday.txt day1,23.10. day2,22.10. Gandhi Jayanti,02.10. Valentine's Day,14.02.
And my code
#!/usr/bin/perl use Date::Calendar; my $Holiday_File = "/home/otrsvpn/holiday.txt"; open FILE, $Holiday_File or die $!; my %holiday; my $holiday_ref = \%holiday; while (<FILE>) { chomp; my ($key, $val) = split /,/; $holiday{$key} .= exists $holiday{$key} ? "$val" : $val; } $calendar = Date::Calendar->new( $holiday_ref ); $days = $calendar->delta_workdays (2015,10,01,2015,10,30,1,0); print " \n There are $days days between 01-10-2015 and 30-10-2015 \n";
This simply prints the number of working days(weekdays and holidays) between the mentioned two dates. Thanks Again
# perl holiday.pl There are 18 days between 01-10-2015 and 30-10-2015
In reply to Re^2: Calculating next business day (weekends/holidays taken into account)
by Hemant1612
in thread Calculating next business day (weekends/holidays taken into account)
by vxp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |