php-extended / php-datetime-parser-object
A library that implements php-extended\php-datetime-parser-interface library
Package info
gitlab.com/php-extended/php-datetime-parser-object
pkg:composer/php-extended/php-datetime-parser-object
9.6.8
2026-05-20 00:55 UTC
Requires
- php: >=8.2
- php-extended/php-datetime-parser-interface: ^9
- php-extended/php-parser-object: ^9
Requires (Dev)
This package is auto-updated.
Last update: 2026-06-19 23:08:40 UTC
README
A library that implements php-extended/php-datetime-parser-interface library.
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.pharfrom their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-datetime-parser-object ^9
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).