PHP code example of joefallon / phptime

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

    

joefallon / phptime example snippets


use JoeFallon\TimeUtil\Chronograph;

$chrono = new Chronograph();
$chrono->start();   // start the chronograph

// Perform other work.

$chrono->stop();    // stop the chronograph
$ms = $chrono->getElapsedTimeInMillisecs();

use JoeFallon\TimeUtil\Chronograph;

$chrono = new Chronograph();
$chrono->start();   // start the chronograph

// Perform other work.

$chrono->stop();    // stop the chronograph
$secs = $chrono->getElapsedTimeInSeconds();

class Days
{
    const SUN = 'Sunday';
    const MON = 'Monday';
    const TUE = 'Tuesday';
    const WED = 'Wednesday';
    const THU = 'Thursday';
    const FRI = 'Friday';
    const SAT = 'Saturday';
}

class Months
{
    const JAN = 'January';
    const FEB = 'February';
    const MAR = 'March';
    const APR = 'April';
    const MAY = 'May';
    const JUN = 'June';
    const JUL = 'July';
    const AUG = 'August';
    const SEP = 'September';
    const OCT = 'October';
    const NOV = 'November';
    const DEC = 'December';
}

use JoeFallon\TimeUtil\MySqlDateTime;

$mysqlNow = MySqlDateTime::nowTimestamp(); // e.g. 2014-07-15 18:23:45