private function parseDate($row)
 {
     $fieldname = $this->getFieldName();
     if (!empty($row) && isset($row[$fieldname])) {
         $value = $row[$fieldname] . ' Etc/UTC';
     } else {
         $value = DateTimeObj::getGMT('Y-m-d H:i:s') . ' Etc/UTC';
     }
     $date = DateTimeObj::parse($value);
     return $date;
 }
示例#2
0
 /**
  * Generates a XMLElement representation of a `<time>`
  *
  * @since Symphony 2.3
  * @param string $string
  *  A string containing date and time, defaults to the current date and time
  * @param string $format (optional)
  *  A valid PHP date format, defaults to `__SYM_TIME_FORMAT__`
  * @param boolean $pubdate (optional)
  *  A flag to make the given date a publish date
  * @return XMLElement
  */
 public static function Time($string, $format = __SYM_TIME_FORMAT__, $pubdate = false)
 {
     // Parse date
     $date = DateTimeObj::parse($string);
     // Create element
     $obj = new XMLElement('time', Lang::localizeDate($date->format($format)));
     $obj->setAttribute('datetime', $date->format(DateTime::ISO8601));
     $obj->setAttribute('utc', $date->format('U'));
     // Pubdate?
     if ($pubdate === true) {
         $obj->setAttribute('pubdate', 'pubdate');
     }
     return $obj;
 }