PHP code example of webtoucher / calendar

1. Go to this page and download the library: Download webtoucher/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/ */

    

webtoucher / calendar example snippets


$calendar = new Calendar(new Schedule('ru'));

$calendar = new Calendar(new Schedule('/var/www/my-site/rules/pl'));

echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-24'), new \DateTime('2016-02-29')); // 3

echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-29'), new \DateTime('2016-02-24')); // -3

echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-24'), 5); // 3

echo $calendar->calendarToWorkingDays(new \DateTime('2016-02-29'), -5); // -3

echo $calendar->workingToCalendarDays(new \DateTime('2016-02-24'), 3); // 5

echo $calendar->workingToCalendarDays(new \DateTime('2016-02-29'), -3); // -5

$ php composer.phar