PHP code example of joomla / datetime

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

    

joomla / datetime example snippets


$start = new DateTime('2014-08-24');
$end = $start->addDays(2);

echo $start->format('Y-m-d');  // 2014-08-24
echo $end->format('Y-m-d');    // 2014-08-26