php-extended/php-datetime-parser-object

A library that implements php-extended\php-datetime-parser-interface library

Installs: 170 798

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

pkg:composer/php-extended/php-datetime-parser-object


README

A library that implements php-extended/php-datetime-parser-interface library.

coverage build status

Installation

The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.

  • Download composer.phar from their website.
  • Then run the following command to install this library as dependency :
  • php composer.phar php-extended/php-datetime-parser-object ^8

Basic Usage

You may use this library the following way :


use PhpExtended\DateTime\DateTimeImmutableParser();

$dtp = new DateTimeImmutableParser();
$dtp->addFormat('<my custom format>'); // @see DateTime:createFromFormat()

try
{
	$dt = $dtp->parse('<my to-be-parsed date-string>');
	// $dt instanceof \DateTimeImmutable
	// do stgh
}
catch(ParseException $e)
{
	// do stgh else
}

License

MIT (See license file).