当前位置: 首页>>代码示例>>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;未经允许,请勿转载。