當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DateTimeParser::parseDate方法代碼示例

本文整理匯總了PHP中Sabre\VObject\DateTimeParser::parseDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateTimeParser::parseDate方法的具體用法?PHP DateTimeParser::parseDate怎麽用?PHP DateTimeParser::parseDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sabre\VObject\DateTimeParser的用法示例。


在下文中一共展示了DateTimeParser::parseDate方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testParseICalendarDateBadFormat

 /**
  * @depends testParseICalendarDate
  * @expectedException LogicException
  */
 function testParseICalendarDateBadFormat()
 {
     $dateTime = DateTimeParser::parseDate('20100316T141405');
 }
開發者ID:floffel03,項目名稱:pydio-core,代碼行數:8,代碼來源:DateTimeParserTest.php

示例2: validate

 /**
  * Validates the node for correctness.
  *
  * The following options are supported:
  *   Node::REPAIR - May attempt to automatically repair the problem.
  *
  * This method returns an array with detected problems.
  * Every element has the following properties:
  *
  *  * level - problem level.
  *  * message - A human-readable string describing the issue.
  *  * node - A reference to the problematic node.
  *
  * The level means:
  *   1 - The issue was repaired (only happens if REPAIR was turned on)
  *   2 - An inconsequential issue
  *   3 - A severe issue.
  *
  * @param int $options
  * @return array
  */
 public function validate($options = 0)
 {
     $messages = parent::validate($options);
     $valueType = $this->getValueType();
     $value = $this->getValue();
     try {
         switch ($valueType) {
             case 'DATE':
                 $foo = DateTimeParser::parseDate($value);
                 break;
             case 'DATE-TIME':
                 $foo = DateTimeParser::parseDateTime($value);
                 break;
         }
     } catch (\LogicException $e) {
         $messages[] = array('level' => 3, 'message' => 'The supplied value (' . $value . ') is not a correct ' . $valueType, 'node' => $this);
     }
     return $messages;
 }
開發者ID:MetallianFR68,項目名稱:myroundcube,代碼行數:40,代碼來源:DateTime.php

示例3: validate

 /**
  * Validates the node for correctness.
  *
  * The following options are supported:
  *   Node::REPAIR - May attempt to automatically repair the problem.
  *
  * This method returns an array with detected problems.
  * Every element has the following properties:
  *
  *  * level - problem level.
  *  * message - A human-readable string describing the issue.
  *  * node - A reference to the problematic node.
  *
  * The level means:
  *   1 - The issue was repaired (only happens if REPAIR was turned on)
  *   2 - An inconsequential issue
  *   3 - A severe issue.
  *
  * @param int $options
  *
  * @return array
  */
 function validate($options = 0)
 {
     $messages = parent::validate($options);
     $valueType = $this->getValueType();
     $values = $this->getParts();
     try {
         foreach ($values as $value) {
             switch ($valueType) {
                 case 'DATE':
                     DateTimeParser::parseDate($value);
                     break;
                 case 'DATE-TIME':
                     DateTimeParser::parseDateTime($value);
                     break;
             }
         }
     } catch (InvalidDataException $e) {
         $messages[] = ['level' => 3, 'message' => 'The supplied value (' . $value . ') is not a correct ' . $valueType, 'node' => $this];
     }
     return $messages;
 }
開發者ID:linagora,項目名稱:sabre-vobject,代碼行數:43,代碼來源:DateTime.php

示例4: testParseICalendarDateInvalidDate

 /**
  * @depends testParseICalendarDate
  * @expectedException \Sabre\VObject\InvalidDataException
  */
 function testParseICalendarDateInvalidDate()
 {
     $dateTime = DateTimeParser::parseDate('20101331');
 }
開發者ID:Radiergummi,項目名稱:anacronism,代碼行數:8,代碼來源:DateTimeParserTest.php


注:本文中的Sabre\VObject\DateTimeParser::parseDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。