public static function convertToJsFormat($pattern)
    {
        if (false === strpos($pattern, 'yyyy')) {
            if (false !== strpos($pattern, 'yy')) {
                $pattern = str_replace('yy', 'yyyy', $pattern);
            } elseif (false !== strpos($pattern, 'y')) {
                $pattern = str_replace('y', 'yyyy', $pattern);
            }
        }

        $pattern = str_replace('d', 'D', $pattern);
        $pattern = str_replace('y', 'Y', $pattern);
        $pattern = str_replace('a', 'A', $pattern);

        return $pattern;
    }
public static function convertToJsFormat($pattern)
    {
        if (false === strpos($pattern, 'yyyy')) {
            if (false !== strpos($pattern, 'yy')) {
                $pattern = str_replace('yy', 'yyyy', $pattern);
            } elseif (false !== strpos($pattern, 'y')) {
                $pattern = str_replace('y', 'yyyy', $pattern);
            }
        }

        $pattern = str_replace('d', 'D', $pattern);
        $pattern = str_replace('y', 'Y', $pattern);
        $pattern = str_replace('a', 'A', $pattern);

        return $pattern;
    }
public static function convertToJsFormat ( $ pattern ) { if ( false === strpos ( $ pattern , 'yyyy' ) ) { if ( false !== strpos ( $ pattern , 'yy' ) ) { $ pattern = str_replace ( 'yy' , 'yyyy' , $ pattern ) ; } elseif ( false !== strpos ( $ pattern , 'y' ) ) { $ pattern = str_replace ( 'y' , 'yyyy' , $ pattern ) ; } } $ pattern = str_replace ( 'd' , 'D' , $ pattern ) ; $ pattern = str_replace ( 'y' , 'Y' , $ pattern ) ; $ pattern = str_replace ( 'a' , 'A' , $ pattern ) ; return $ pattern ; }
Convert the php pattern to javascript pattern.

@param string $pattern The php pattern

@return string
Convert the php pattern to javascript pattern .