public function testCreatesIS08601WithFractionalSeconds() { $time = '2009-03-07T08:03:50.012Z'; $date = DateTime::createFromISO8601($time); $standard = \DateTime::createFromFormat('Y-m-d\\TH:i:s.uO', $time); $this->assertEquals($standard, $date); }
/** * Get the entry modification date * * @return string */ public function getDateModified() { if (array_key_exists('datemodified', $this->data)) { return $this->data['datemodified']; } $date = null; if ($this->getAtomType() === Reader\Reader::TYPE_ATOM_03) { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:modified)'); } else { $dateModified = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/atom:updated)'); } if ($dateModified) { $date = DateTime::createFromISO8601($dateModified); } $this->data['datemodified'] = $date; return $this->data['datemodified']; }
/** * * * @return DateTime|null */ public function getDate() { if (array_key_exists('date', $this->data)) { return $this->data['date']; } $d = null; $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc11:date)'); if (!$date) { $date = $this->getXpath()->evaluate('string(' . $this->getXpathPrefix() . '/dc10:date)'); } if ($date) { $d = DateTime::createFromISO8601($date); } $this->data['date'] = $d; return $this->data['date']; }