parse() public method

Parse a date from string with a format to a DateTime object
public parse ( string $string, string $format ) : DateTime
$string string
$format string
return DateTime
コード例 #1
0
 /**
  * @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);
 }