php-extended/php-datetime-parser-object

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

4.0.2 2022-06-03 20:44 UTC

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. Download composer.phar from their website. Then add to your composer.json :

	"require": {
		...
		"php-extended/php-datetime-parser-object": "^3"
		...
	}

Then run php composer.phar update to install this library. The autoloading of all classes of this library is made through composer's autoloader.

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).