PHP code example of refactoring / time

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

    

refactoring / time example snippets


echo "First of last month was ",$lastMonth->getStart()->format("Y-m-d"),"\n";

$today = new \DateTime();

if (!($lastMonth->contains($today))) {
    echo "Today is not contained in last month \n";
}

$thisMonth = new ThisMonth();

if ($thisMonth->contains($today)) {
    echo "This month contains today\n";
}
$thisYear = new ThisYear();

if ($thisYear->overlaps($lastMonth)) {
    echo "This year overlaps with last month \n";
}