private function convertToUtcDate($date = '') { // will be in current TIME_ZONE $dateTime = new DateTime($date); $dateTime->setTimezone(new \DateTimeZone('UTC')); return $dateTime->format(\DateTime::ISO8601); }
/** * @covers oat\dtms\DateTime::format */ public function testFormat() { $dt = new DateTime('2015-08-08 10:10:10.123456'); $this->assertSame('08.08.2015 10:10:10.123456', $dt->format('d.m.Y H:i:s.u')); $this->assertSame('08.08.2015 10:10:10', $dt->format('d.m.Y H:i:s')); $this->assertSame('1439028610.123456', $dt->format('U.u')); }