readDate() 공개 정적인 메소드

Parse the provided string into a PHP DateTime object.
public static readDate ( string $date, string $timezone = null ) : DateTime
$date string The Kolab date value.
$timezone string The associated timezone. Deprecated.
리턴 DateTime The date-time value represented as PHP DateTime object.
예제 #1
0
파일: V1.php 프로젝트: raz0rsdge/horde
 /**
  * Load the value of a node.
  *
  * @param DOMNode                       $node   Retrieve value for this node.
  * @param Horde_Kolab_Format_Xml_Helper $helper A XML helper instance.
  * @param array                         $params Additiona parameters for
  *                                              this parse operation.
  *
  * @return mixed|null The value or null if no value was found.
  */
 public function loadNodeValue($node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     $result = $helper->fetchNodeValue($node);
     if (strlen($result) == 10) {
         return array('date' => Horde_Kolab_Format_Date::readDate($result), 'date-only' => true);
     }
     return array('date' => Horde_Kolab_Format_Date::readDateTime($result), 'date-only' => false);
 }
예제 #2
0
파일: Date.php 프로젝트: horde/horde
 /**
  * Load the value of a node.
  *
  * @param DOMNode                       $node   Retrieve value for this node.
  * @param Horde_Kolab_Format_Xml_Helper $helper A XML helper instance.
  * @param array                         $params Additiona parameters for
  *                                              this parse operation.
  *
  * @return mixed|null The value or null if no value was found.
  */
 public function loadNodeValue($node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     $result = $helper->fetchNodeValue($node);
     $date = Horde_Kolab_Format_Date::readDate($result);
     if ($date === false && !$this->isRelaxed($params)) {
         throw new Horde_Kolab_Format_Exception(sprintf('Invalid date input "%s"!', $result));
     }
     return $date;
 }
예제 #3
0
 /**
  * Load the value of a node.
  *
  * @param DOMNode                       $node   Retrieve value for this node.
  * @param Horde_Kolab_Format_Xml_Helper $helper A XML helper instance.
  * @param array                         $params Additiona parameters for
  *                                              this parse operation.
  *
  * @return mixed|null The value or null if no value was found.
  */
 public function loadNodeValue($node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     $result = $helper->fetchNodeValue($node);
     $type = $node->getAttribute('type');
     if (empty($type) || $type == 'none') {
         return null;
     }
     if ($type == 'date') {
         return Horde_Kolab_Format_Date::readDate($result);
     }
     return $result;
 }
예제 #4
0
 /**
  * Load the value of a node.
  *
  * @param DOMNode                       $node   Retrieve value for this node.
  * @param Horde_Kolab_Format_Xml_Helper $helper A XML helper instance.
  * @param array                         $params Additiona parameters for
  *                                              this parse operation.
  *
  * @return mixed|null The value or null if no value was found.
  */
 public function loadNodeValue($node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     $result = $helper->fetchNodeValue($node);
     if (strlen($result) == 10) {
         $date = array('date' => Horde_Kolab_Format_Date::readDate($result), 'date-only' => true);
     } else {
         $date = array('date' => Horde_Kolab_Format_Date::readDateTime($result), 'date-only' => false);
     }
     if ($date['date'] === false && !$this->isRelaxed($params)) {
         throw new Horde_Kolab_Format_Exception(sprintf('Invalid date input "%s"!', $result));
     }
     return $date;
 }
예제 #5
0
파일: V1.php 프로젝트: horde/horde
 /**
  * Load the value of a node.
  *
  * @param DOMNode                       $node   Retrieve value for this node.
  * @param Horde_Kolab_Format_Xml_Helper $helper A XML helper instance.
  * @param array                         $params Additiona parameters for
  *                                              this parse operation.
  *
  * @return mixed|null The value or null if no value was found.
  */
 public function loadNodeValue($node, Horde_Kolab_Format_Xml_Helper $helper, $params = array())
 {
     $result = $helper->fetchNodeValue($node);
     return Horde_Kolab_Format_Date::readDate($result);
 }