PHP code example of tochka-developers / work-calendar

1. Go to this page and download the library: Download tochka-developers/work-calendar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tochka-developers / work-calendar example snippets


$date = WorkCalendar::create('2018', '02', '22');
print_r($date->isWorkday()); // true
...
$date->addDay(); // 2018-02-23, день защитника отечества
print_r($date->isWorkday()); // false
...
$date->addWorkday();
print_r($date->format('Y-m-d') // 2018-02-26
...
$date->subWorkday();
print_r($date->format('Y-m-d') // 2018-02-22
...
$date->addWorkdays(5);
print_r($date->format('Y-m-d') // 2018-03-02
...
$date->subWorkdays(5);
print_r($date->format('Y-m-d') // 2018-02-22