PHP code example of leaditin / moment

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

    

leaditin / moment example snippets


use \Leaditin\Moment\Time;

$time = Time::fromSeconds(7200);
$time = Time::fromString('12:25');

use \Leaditin\Moment\DateTime;

$now = new DateTime();
$today = new DateTime('now', null, DateTime::TYPE_DATE);
$past = new DateTime('26 Jul 1984', null, DateTime::TYPE_DATE);

use \Leaditin\Moment\{DateTime, DateRange};

$range = new DateRange(new DateTime('2016-01-01 00:00:00'), new DateTime('2016-12-31 23:59:59'));
$infinityLeft = new DateRange(null, new DateTime());
$infinityRight = new DateRange(new DateTime(), null);
$infinity = new DateRange();