Skip to content
Business Days Calculator
Branch: master
Clone or download
royopa and andrejsstepanovs changed php-coveralls package (#10)
Package satooshi/php-coveralls is abandoned, you should avoid using it. Use php-coveralls/php-coveralls instead.
Latest commit 0a85090 May 27, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/BusinessDays expose extra methods Jul 15, 2016
tests
.gitignore
.scrutinizer.yml update ci tools Jan 6, 2015
.travis.yml added more php versions to travis Apr 18, 2018
LICENSE.md Create LICENSE.md Mar 17, 2016
README.md
composer.json changed php-coveralls package (#10) May 26, 2018

README.md

business-days-calculator

Business Days Calculator

Build Status Scrutinizer Quality ScoreCoverage Status Latest Stable Version License

Install

  • If you're using Composer to manage dependencies, you can use
composer require andrejsstepanovs/business-days-calculator

or add to your composer.json file:

"require": {
    "andrejsstepanovs/business-days-calculator": "1.*",
}

Example

use \BusinessDays\Calculator;

$holidays = [
    new \DateTime('2000-12-31'),
    new \DateTime('2001-01-01')
];

$freeDays = [
    new \DateTime('2000-12-28')
];

$freeWeekDays = [
    Calculator::SATURDAY,
    Calculator::SUNDAY
];

$calculator = new Calculator();
$calculator->setStartDate(new \DateTime('2000-12-27'));
$calculator->setFreeWeekDays($freeWeekDays); // repeat every week
$calculator->setHolidays($holidays);         // repeat every year
$calculator->setFreeDays($freeDays);         // don't repeat

$calculator->addBusinessDays(3);             // add X working days

$result = $calculator->getDate();            // \DateTime
echo $result->format('Y-m-d');               // 2001-01-03
You can’t perform that action at this time.