PHP Classes

PHP Working Days: Calculate the total working days between two dates

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 56%Total: 497 All time: 5,845 This week: 59Up
Version License PHP version Categories
working-days 1.9GNU General Publi...5.3PHP 5, Time and Date
Description 

Author

This class can calculate the total working days between two dates.

It takes a start date and a end date and it computes the total number of working days excluding the weekend and holiday days that happen between the dates.

The days of the week that are considered weekend days and the holidays dates are configurable parameters.

Picture of Tariqul Islam
  Performance   Level  
Name: Tariqul Islam <contact>
Classes: 3 packages by
Country: Bangladesh Bangladesh

Example

<?php
require("totalworkingdays.php");

//initialize the class
$twd = new totalWorkingDays();
//set Holiday by its name (optional)
$twd->setHoliday(array('Friday','Saturday'));
//set Dates as Holiday (optional)
$twd->setHolidate(array('1st January 2015', '2015-01-12', '21-01-2015'));
//Calculate to find total working days
echo $twd->calculate("2015-01-01", "2015-01-31") . " Working days.";

?>


  Files folder image Files (2)  
File Role Description
Accessible without login Plain text file example.php Example Usage Example
Plain text file totalworkingdays.php Class Main Class File

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:497
This week:0
All time:5,845
This week:59Up
 User Ratings  
 
 All time
Utility:81%StarStarStarStarStar
Consistency:81%StarStarStarStarStar
Documentation:-
Examples:81%StarStarStarStarStar
Tests:-
Videos:-
Overall:56%StarStarStar
Rank:1759