当前位置: 首页>>代码示例>>PHP>>正文


PHP Date::getNumericTimeFormat方法代码示例

本文整理汇总了PHP中Contao\Date::getNumericTimeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::getNumericTimeFormat方法的具体用法?PHP Date::getNumericTimeFormat怎么用?PHP Date::getNumericTimeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contao\Date的用法示例。


在下文中一共展示了Date::getNumericTimeFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getSeparatedNumericDateTimeInterval

 public static function getSeparatedNumericDateTimeInterval($intStartDate = null, $intEndDate = null, $intStartTime = null, $intEndTime = null, $strIntervalDelimiter = ' – ', $strDelimiter = ', ')
 {
     $strStartDate = \Contao\Date::parse(\Contao\Date::getNumericDateFormat(), $intStartDate);
     $strEndDate = \Contao\Date::parse(\Contao\Date::getNumericDateFormat(), $intEndDate);
     $strStartTime = \Contao\Date::parse(\Contao\Date::getNumericTimeFormat(), $intStartTime);
     $strEndTime = \Contao\Date::parse(\Contao\Date::getNumericTimeFormat(), $intEndTime);
     $strResult = $strStartDate;
     if ($intEndDate > 0 && $intEndDate > $intStartDate && $strStartDate != $strEndDate) {
         $strResult .= $strIntervalDelimiter . $strEndDate;
     }
     if ($intStartTime > 0) {
         if ($intEndTime > $intStartTime && $strStartTime != $strEndTime) {
             $strResult .= $strDelimiter . $strStartTime . $strIntervalDelimiter . $strEndTime;
         } else {
             $strResult .= $strDelimiter . $strStartTime;
         }
     }
     return $strResult;
 }
开发者ID:heimrichhannot,项目名称:contao-haste_plus,代码行数:19,代码来源:DateUtil.php

示例2: validator


//.........这里部分代码省略.........
                 break;
                 // Alphanumeric characters (including full stop [.] minus [-], underscore [_] and space [ ])
             // Alphanumeric characters (including full stop [.] minus [-], underscore [_] and space [ ])
             case 'alnum':
                 if (!\Validator::isAlphanumeric($varInput)) {
                     $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['alnum'], $this->strLabel));
                 }
                 break;
                 // Do not allow any characters that are usually encoded by class Input ([#<>()\=])
             // Do not allow any characters that are usually encoded by class Input ([#<>()\=])
             case 'extnd':
                 if (!\Validator::isExtendedAlphanumeric(html_entity_decode($varInput))) {
                     $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['extnd'], $this->strLabel));
                 }
                 break;
                 // Check whether the current value is a valid date format
             // Check whether the current value is a valid date format
             case 'date':
                 if (!\Validator::isDate($varInput)) {
                     $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['date'], \Date::getInputFormat(\Date::getNumericDateFormat())));
                 } else {
                     // Validate the date (see #5086)
                     try {
                         new \Date($varInput, \Date::getNumericDateFormat());
                     } catch (\OutOfBoundsException $e) {
                         $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $varInput));
                     }
                 }
                 break;
                 // Check whether the current value is a valid time format
             // Check whether the current value is a valid time format
             case 'time':
                 if (!\Validator::isTime($varInput)) {
                     $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['time'], \Date::getInputFormat(\Date::getNumericTimeFormat())));
                 }
                 break;
                 // Check whether the current value is a valid date and time format
             // Check whether the current value is a valid date and time format
             case 'datim':
                 if (!\Validator::isDatim($varInput)) {
                     $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['dateTime'], \Date::getInputFormat(\Date::getNumericDatimFormat())));
                 } else {
                     // Validate the date (see #5086)
                     try {
                         new \Date($varInput, \Date::getNumericDatimFormat());
                     } catch (\OutOfBoundsException $e) {
                         $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $varInput));
                     }
                 }
                 break;
                 // Check whether the current value is a valid friendly name e-mail address
             // Check whether the current value is a valid friendly name e-mail address
             case 'friendly':
                 list($strName, $varInput) = \StringUtil::splitFriendlyEmail($varInput);
                 // no break;
                 // Check whether the current value is a valid e-mail address
             // no break;
             // Check whether the current value is a valid e-mail address
             case 'email':
                 if (!\Validator::isEmail($varInput)) {
                     $this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['email'], $this->strLabel));
                 }
                 if ($this->rgxp == 'friendly' && !empty($strName)) {
                     $varInput = $strName . ' [' . $varInput . ']';
                 }
                 break;
开发者ID:contao,项目名称:core-bundle,代码行数:67,代码来源:Widget.php


注:本文中的Contao\Date::getNumericTimeFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。