ugraweb/moment

There is no license information available for the latest version (1.1) of this package.

A simple API for Time, DateTime and DateRange.

1.1 2017-09-12 13:15 UTC

This package is not auto-updated.

Last update: 2020-08-08 05:19:43 UTC


README

A simple PHP API for Time, DateTime and DateRange.

Build Status Code Quality Code Coverage Latest Version PDS Skeleton

Installation

The preferred method of installation is via Composer. Run the following command to install the latest version of a package and add it to your project's composer.json:

composer require arbor-education/moment

Usage

Instantiate Time object

use \Arbor\Moment\Time;

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

Instantiate DateTime object

use \Arbor\Moment\DateTime;

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

Instantiate DateRange object

use \Arbor\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();

Credits

License

Released under MIT License - see the License File for details.