2017 © Pedro Peláez
 

library phptime

This package contains a set of classes for making it easier to work with time in PHP.

image

joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  • Sunday, December 27, 2015
  • by jfallon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 132 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 12 Versions
  • 16 % Grown

The README.md

phptime

By Joe Fallon, (*1)

Joe's PHP Time Utilities is a set of classes useful for assisting with working with time related values in PHP and MySQL. It is important to note that this is not an all inclusive date and time solution. Currently, it provides the following capabilities:, (*2)

  1. A millisecond resolution chronograph is provided to easily measure the elapsed time between two events.
  2. A class containing a collection of constants representing every day of the week is provided.
  3. A class containing a collection of constants representing every month of the year is provided.
  4. A class containing a method for getting a time stamp that is suitable for immediate insertion into MySQL (i.e. Y-m-d H:i:s) is provided.

Installation

The easiest way to install Joe's PHP Time Utilities is with Composer. Create the following composer.json file and run the php composer.phar install command to install it., (*3)

{
    "require": {
        "joefallon/phptime": "*"
    }
}

Class Documentation

Chronograph

Here is an example of using Chronograph to measure the time elapsed in milliSeconds between a start time and stop time:, (*4)

use JoeFallon\TimeUtil\Chronograph;

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

// Perform other work.

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

Here is an example of using Chronograph to measure the time elapsed in seconds between a start time and stop time:, (*5)

use JoeFallon\TimeUtil\Chronograph;

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

// Perform other work.

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

Days

Here is the contents of the Days class:, (*6)

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

Months

Here is the contents of the Months class:, (*7)

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';
}

MySqlDateTime

Here is an example of using MySqlDateTime to get a time-stamp suitable for immediate insertion into MySQL:, (*8)

use JoeFallon\TimeUtil\MySqlDateTime;

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

The Versions

27/12 2015

dev-master

9999999-dev https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

27/12 2015

dev-develop

dev-develop https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

27/12 2015

v4.0.3

4.0.3.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

05/02 2015

v4.0.2

4.0.2.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

10/01 2015

v4.0.1

4.0.1.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

10/01 2015

v4.0.0

4.0.0.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

10/01 2015

v3.0.1

3.0.1.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

29/10 2014

v3.0.0

3.0.0.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

26/10 2014

v2.0.0

2.0.0.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

22/10 2014

v1.0.2

1.0.2.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

20/10 2014

v1.0.1

1.0.1.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph

29/08 2014

v1.0.0

1.0.0.0 https://github.com/joefallon/phptime

This package contains a set of classes for making it easier to work with time in PHP.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

php time data chronograph