PHP Class for rudimental parsing of ISO8601 DatePeriods e.g. by Amazon Alexas Slot type AMAZON.DATE
Require the package with composer:
composer require gugiman/date-period-parser8601
Use like seen in test.php
<?php
use Gugiman\DatePeriodParser8601;
//$string = "2022-05-10";
//$string = "2022-05";
//$string = "201X";
$string = "2022-W25-WE";
$obj = new DatePeriodParser8601($string);
$obj->getStart();
// returns \DateTime object of start
// $obj->getStart()->format("d.m.Y H:i:s");
// returns 22.06.2022 00:00:00
$obj->getEnd();
// returns \DateTime object of end
// $obj->getEnd()->format("d.m.Y H:i:s");
// returns 23.06.2022 23:59:59
// returns \DatePeriod object with given interval
$obj->asDatePeriod(new \DateInterval("P1D"));
BTC: 1Gn4ofNXpvwYSvyi2wC1kT3Hoas3kaifqx
ETH (ERC20): 0x07d2b052abb86df996276fcc327296f344781ae8