PHP code example of webmasterskaya / production-calendar

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

    

webmasterskaya / production-calendar example snippets


use \Webmasterskaya\ProductionCalendar\Calendar;

Calendar::date(); // вернёт объект \DateTime, на который установлен внутренний указатель класса

$date = '06.05.2020'; // Строкой
$date = '2020-05-13'; // Строкой в другом формате
$date = 1582146000; // Unix Timestamp 
$date = new \DateTime('05.11.2020'); // Объект \DateTime

Calendar::isWorking($date, [6, 0]); //bool
/* или */
Calendar::isWorking($date); //bool
/* или */
Calendar::isWorking(); //bool

Calendar::isHoliday($date); //bool
/* или */
Calendar::isHoliday(); //bool

Calendar::isPreHoliday($date); //bool
/* или */
Calendar::isPreHoliday(); //bool

Calendar::isNoWorking($date); //bool
/* или */
Calendar::isNoWorking(); //bool

Calendar::find($date)->working()->format($format); //string

Calendar::find($date)->holiday()->format($format); //string

Calendar::find($date)->preHoliday()->format($format); //string

Calendar::find($date)->noWorking()->format($format); //string

Calendar::getHolidaysListByInterval($date_from, $date_to, $format); //array

Calendar::getWorkingListByInterval($date_from, $date_to, $format); //array

Calendar::getNoWorkingListByInterval($date_from, $date_to, $format); //array

Calendar::getPreHolidayListByInterval($date_from, $date_to, $format); //array

Updater::update($year); //void

Updater::updateAll(); //void