php-extended / php-datetime-parser-object
A library that implements php-extended\php-datetime-parser-interface library
5.0.0
2022-12-17 22:00 UTC
Requires
Requires (Dev)
This package is auto-updated.
Last update: 2023-05-17 22:46:01 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.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-datetime-parser-object": "^5"
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).