Code example for SimpleDateFormat

Methods: toLocalizedPattern

        // since icu has dropped support for this. the default pattern characters 
        // are these: GyMdkHmsSEDFwWahKz 
        // ICU only! this fails on the RI 
        assertTrue("Wrong pattern: " + pattern, pattern
        // test the new "Z" pattern char 
        f2 = new SimpleDateFormat("G y M d Z", new Locale("de", "CH"));
        pattern = f2.toLocalizedPattern();
        // assertTrue("Wrong pattern: " + pattern, pattern.equals("G u M t Z")); 
        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));
        // END android-changed 
    public void test_toPattern() { 
        String pattern = "yyyy mm dd";
        SimpleDateFormat f = new SimpleDateFormat(pattern);
        assertEquals("Wrong pattern: " + pattern, pattern, f.toPattern());
Contextual code suggestions in your IDE  Get Codota for Java