Swat/SwatDateEntry.php
private function getDatePartOrder()
    {
        $format = nl_langinfo(D_FMT);

        // expand short form format
        $format = str_replace('%D', '%m/%d/%y', $format);

        $day = null;
        $month = null;
        $year = null;

        $matches = array();
        if (
            preg_match('/(%d|%e)/', $format, $matches, PREG_OFFSET_CAPTURE) ===
            1
        ) {
            $day = $matches[0][1];
        }

        $matches = array();
        if (
            preg_match(
                '/(%[bB]|%m)/',
                $format,
                $matches,
                PREG_OFFSET_CAPTURE
            ) === 1
        ) {
            $month = $matches[0][1];
        }

        $matches = array();
        if (
            preg_match('/(%[Yy])/', $format, $matches, PREG_OFFSET_CAPTURE) ===
            1
        ) {
            $year = $matches[0][1];
        }

        if ($day === null || $month === null || $year === null) {
            // fallback to d-m-y if the locale format is unknown
            $order = array('d', 'm', 'y');
        } else {
            $order = array();
            $order[$day] = 'd';
            $order[$month] = 'm';
            $order[$year] = 'y';
            ksort($order);
        }

        return $order;
    }
private function getDatePartOrder()
    {
        $format = nl_langinfo(D_FMT);

        // expand short form format
        $format = str_replace('%D', '%m/%d/%y', $format);

        $day = null;
        $month = null;
        $year = null;

        $matches = array();
        if (
            preg_match('/(%d|%e)/', $format, $matches, PREG_OFFSET_CAPTURE) ===
            1
        ) {
            $day = $matches[0][1];
        }

        $matches = array();
        if (
            preg_match(
                '/(%[bB]|%m)/',
                $format,
                $matches,
                PREG_OFFSET_CAPTURE
            ) === 1
        ) {
            $month = $matches[0][1];
        }

        $matches = array();
        if (
            preg_match('/(%[Yy])/', $format, $matches, PREG_OFFSET_CAPTURE) ===
            1
        ) {
            $year = $matches[0][1];
        }

        if ($day === null || $month === null || $year === null) {
            // fallback to d-m-y if the locale format is unknown
            $order = array('d', 'm', 'y');
        } else {
            $order = array();
            $order[$day] = 'd';
            $order[$month] = 'm';
            $order[$year] = 'y';
            ksort($order);
        }

        return $order;
    }
private function getDatePartOrder ( ) { $ format = nl_langinfo ( D_FMT ) ; // expand short form format $ format = str_replace ( '%D' , '%m/%d/%y' , $ format ) ; $ day = null ; $ month = null ; $ year = null ; $ matches = array ( ) ; if ( preg_match ( '/(%d|%e)/' , $ format , $ matches , PREG_OFFSET_CAPTURE ) === 1 ) { $ day = $ matches [ 0 ] [ 1 ] ; } $ matches = array ( ) ; if ( preg_match ( '/(%[bB]|%m)/' , $ format , $ matches , PREG_OFFSET_CAPTURE ) === 1 ) { $ month = $ matches [ 0 ] [ 1 ] ; } $ matches = array ( ) ; if ( preg_match ( '/(%[Yy])/' , $ format , $ matches , PREG_OFFSET_CAPTURE ) === 1 ) { $ year = $ matches [ 0 ] [ 1 ] ; } if ( $ day === null || $ month === null || $ year === null ) { // fallback to d-m-y if the locale format is unknown $ order = array ( 'd' , 'm' , 'y' ) ; } else { $ order = array ( ) ; $ order [ $ day ] = 'd' ; $ order [ $ month ] = 'm' ; $ order [ $ year ] = 'y' ; ksort ( $ order ) ; } return $ order ; }
Gets the order of date parts for the current locale

Note: The technique used within this method does not work correcty for
RTL languages that display month names, month abbreviations or weekday
names. Since we're displaying months textually these locales may have
date parts incorrectly ordered.

@return array an array containg the values 'd', 'm' and 'y' in the
correct order for the current locale.
Gets the order of date parts for the current locale