PHP Classes


Recommend this page to a friend!
  Classes of Fernando Val   PHP Business Days Calculator   Download  
Role: Documentation
Content type: text/markdown
Description: Read me
Class: PHP Business Days Calculator
Get the business days after today or a given date
Author: By
Last change: Enhances project description.

Thanks to Manuel Lemos
Date: 2 years ago
Size: 3,049 bytes


Class file image Download

PHP Business Days Calculator

Latest Stable Version Build Status PHP Composer PHPStan Codacy Badge StyleCI Total Downloads License

This class can get the business days after today or a given date.

It can take as parameter a given date that will be taken as a reference.

The class can return one or more dates of the next business days after the given date considering the weekends and the regular holiday dates like Christmas, Easter, Corpus Christi, etc..

Optionally the class can also consider business days of specific countries like Brazil.


  • PHP 7.3+


To get the latest stable version of this component use:

"require": {
    "springy-framework/business-days-calculator": "*"

in your composer.json file.


I suppose that the following example is all you need:


require 'vendor/autoload.php'; // If you're using Composer (recommended)

// Using dynamic mode
$today = new DateTime();
$bdCalc = new Springy\BusinessDaysCalculator($today);
$newDate = $bdCalc->addBrazilianHolidays((int) $today->format('Y'))
    ->addBrazilianHolidays((int) $today->format('Y') + 1)

if ($bdCalc->isBusinessDay()) {
    echo "Is a business day\n";

// Getting nth business date in 'Y-m-d' format string without create an object
echo "The 20th business day from now is "
    . Springy\BusinessDaysCalculator::getBusinessDate(20)
    . "\n";


Please read our contributing document and thank you for doing that.

Code of Conduct

In order to ensure that our community is welcoming to all, please review and abide by the code of conduct.


This project is licensed under The MIT License (MIT).