Prado\I18N\TDateFormat::getPattern PHP Method

getPattern() public method

Gets the date time format pattern.
public getPattern ( ) : string
return string format pattern.
    public function getPattern()
    {
        $string = $this->getViewState('Pattern', '');
        $pattern = null;
        //try the subpattern of "date time" presets
        $subpatterns = explode(' ', $string, 2);
        $datetime = array();
        if (count($subpatterns) == 2) {
            $datetime[] = $this->getPreset($subpatterns[0]);
            $datetime[] = $this->getPreset($subpatterns[1]);
        }
        //we have a good subpattern
        if (count($datetime) == 2 && strlen($datetime[0]) == 1 && strlen($datetime[1]) == 1) {
            $pattern = $datetime;
        } else {
            //no subpattern, try the presets
            $pattern = $this->getPreset($string);
        }
        //no presets found, use the string as the pattern
        //and let the DateFormat handle it.
        if ($pattern === null) {
            $pattern = $string;
        }
        if (!is_array($pattern) && strlen($pattern) == 0) {
            $pattern = null;
        }
        return $pattern;
    }