PHP code example of zarte / holiday

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

    

zarte / holiday example snippets


  $Holiday = new Holiday();
  $Holiday->setFilePath(config('FileSavePath'));
  $year=2021;
  if(!$Holiday->getYearHoliday($year)){
    var_dump($Holiday->errmsg);
   ... 
  }
  $starttime = strtotime('2021-01-01');
  $seconds = $Holiday->getDifferSeconds($starttime,time());


     /**
        * 设置缓存文件路径
        * @param $path
        * @param string $filenamepre
        */

       /**
        * 获取特定日期节假日状态
        * @param int $day
        * @return int  0平日1假日2补班3周末
        * @throws \Exception
        */

      /**
          * 生成缓存文件
          * @param $year 2021
          * @return bool
          */

 /**
     * 返回两个日期相差不含非工作日的秒数
     * @param $stattime 时间戳(秒)
     * @param $endtime
     * @return int
     * @throws \Exception
     */

  /**
      * 获取节假日与补班列表
      * @param $year
      * @return bool|mixed
      */