Contao\Date::getFormatFromRgxp PHP Method

getFormatFromRgxp() public static method

Return a numeric format string depending on the regular expression name
public static getFormatFromRgxp ( string $strRgxp ) : string
$strRgxp string The regular expression name
return string The numeric format string
    public static function getFormatFromRgxp($strRgxp)
    {
        switch ($strRgxp) {
            case 'date':
                return static::getNumericDateFormat();
                break;
            case 'time':
                return static::getNumericTimeFormat();
                break;
            case 'datim':
                return static::getNumericDatimFormat();
                break;
        }
        return null;
    }

Usage Example

コード例 #1
0
 /**
  * Obtain the correct date/time string.
  *
  * @return string
  */
 private function determineDateFormat()
 {
     if ($format = trim($this->get('dateformat'))) {
         return $format;
     }
     return Date::getFormatFromRgxp($this->get('timetype'));
 }
All Usage Examples Of Contao\Date::getFormatFromRgxp