public function test_create_from_format_with_tz()
 {
     $d = DateTime::createFromFormat('Y-m-d H:i:s', '2000-02-01 03:04:05', new \DateTimeZone('Etc/GMT-10'));
     $d2 = new DateTime('2000-01-31 17:04:05');
     $this->assert_equals($d2->getTimestamp(), $d->getTimestamp());
 }
Example #2
0
 public function testCreateFromFormatWithoutTz()
 {
     $d = DateTime::createFromFormat('H:i:s Y-d-m', '03:04:05 2000-02-01');
     $this->assertEquals(new DateTime('2000-01-02 03:04:05'), $d);
 }