Neos\Eel\Helper\DateHelper::parse PHP Метод

parse() публичный Метод

Parse a date from string with a format to a DateTime object
public parse ( string $string, string $format ) : DateTime
$string string
$format string
Результат DateTime
    public function parse($string, $format)
    {
        return \DateTime::createFromFormat($format, $string);
    }

Usage Example

 /**
  * @test
  * @dataProvider parseExamples
  */
 public function parseWorks($string, $format, $expected)
 {
     $helper = new DateHelper();
     $result = $helper->parse($string, $format);
     $this->assertInstanceOf(\DateTime::class, $result);
     $this->assertEquals((double) $expected->format('U'), (double) $result->format('U'), 'Timestamps should match', 60);
 }