PHP code example of ludovicm67 / superdate

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

    

ludovicm67 / superdate example snippets




// import here the composer autoloader
dovicm67\SuperDate\Date;

// your code below...

// value: today
$date = new Date();
$date = new Date(null);

// value: specified date
$date = new Date("2019-03-21");

$date = new Date("2019-03-21");
$allDaysTo = $date->allDaysTo("2019-04-03");

// $allDaysTo will be an array containing all 14 days
// between 2019-03-21 and 2019-04-03 

$date->isWeekDay(); // true if between monday and friday, false if saturday or sunday
$date->isWeekEnd(); // false if between monday and friday, true if saturday or sunday

$date->isHoliday(); // true if holiday, false if not