Пример #1
0
 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);
 }
Пример #2
0
 /**
  * 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'];
 }
Пример #3
0
 /**
  *
  *
  * @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'];
 }