Examples of applyLocalizedPattern()


Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

                df.applyPattern(pattern);
            }
        } else if (format instanceof SimpleDateFormat) {
            final SimpleDateFormat df = (SimpleDateFormat) format;
            if (localized) {
                df.applyLocalizedPattern(pattern);
            } else {
                df.applyPattern(pattern);
            }
        } else if (format instanceof AngleFormat) {
            ((AngleFormat) format).applyPattern(pattern);
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

    public static String formatDateForDisplay(Locale locale, Date date) {
  DateFormat dateFormat = DateFormat.getDateInstance(
      DateFormat.MEDIUM, locale);
  if (dateFormat instanceof SimpleDateFormat) {
      SimpleDateFormat fmt = (SimpleDateFormat)dateFormat;
      fmt.applyLocalizedPattern(fmt.toLocalizedPattern()+TIME_FORMAT);
      return fmt.format(date);
  } else {
      dateFormat = DateFormat.getDateTimeInstance(
    DateFormat.MEDIUM, DateFormat.LONG, locale);
      return dateFormat.format(date);
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

    public static String formatDateForDisplay(Locale locale, Date date) {
        DateFormat dateFormat = DateFormat.getDateInstance(
                DateFormat.MEDIUM, locale);
        if (dateFormat instanceof SimpleDateFormat) {
            SimpleDateFormat fmt = (SimpleDateFormat) dateFormat;
            fmt.applyLocalizedPattern(fmt.toLocalizedPattern() + TIME_FORMAT);
            return fmt.format(date);
        } else {
            dateFormat = DateFormat.getDateTimeInstance(
                    DateFormat.MEDIUM, DateFormat.LONG, locale);
            return dateFormat.format(date);
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

    public static String formatDateForDisplay(Locale locale, Date date) {
  DateFormat dateFormat = DateFormat.getDateInstance(
      DateFormat.MEDIUM, locale);
  if (dateFormat instanceof SimpleDateFormat) {
      SimpleDateFormat fmt = (SimpleDateFormat)dateFormat;
      fmt.applyLocalizedPattern(fmt.toLocalizedPattern()+TIME_FORMAT);
      return fmt.format(date);
  } else {
      dateFormat = DateFormat.getDateTimeInstance(
    DateFormat.MEDIUM, DateFormat.LONG, locale);
      return dateFormat.format(date);
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

     */
    public void test_applyLocalizedPatternLjava_lang_String() {
        // Test for method void
        // java.text.SimpleDateFormat.applyLocalizedPattern(java.lang.String)
        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
        f2.applyLocalizedPattern("GuMtkHmsSEDFwWahKz");
        String pattern = f2.toPattern();
        assertTrue("Wrong pattern: " + pattern, pattern
                .equals("GyMdkHmsSEDFwWahKz"));

        // test the new "Z" pattern char
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

        assertTrue("Wrong pattern: " + pattern, pattern
                .equals("GyMdkHmsSEDFwWahKz"));

        // test the new "Z" pattern char
        f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
        f2.applyLocalizedPattern("G u M t Z");
        pattern = f2.toPattern();
        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));

        // test invalid patterns
        try {
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

        pattern = f2.toPattern();
        assertTrue("Wrong pattern: " + pattern, pattern.equals("G y M d Z"));

        // test invalid patterns
        try {
            f2.applyLocalizedPattern("b");
            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: b");
        } catch (IllegalArgumentException e) {
        }

        try {
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: b");
        } catch (IllegalArgumentException e) {
        }

        try {
            f2.applyLocalizedPattern("y");
            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: y");
        } catch (IllegalArgumentException e) {
        }

        try {
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

            fail("Expected IllegalArgumentException for pattern with invalid pattern letter: y");
        } catch (IllegalArgumentException e) {
        }

        try {
            f2.applyLocalizedPattern("a '");
            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
        } catch (IllegalArgumentException e) {
        }

        try {
View Full Code Here

Examples of java.text.SimpleDateFormat.applyLocalizedPattern()

            fail("Expected IllegalArgumentException for pattern with unterminated quote: a '");
        } catch (IllegalArgumentException e) {
        }

        try {
            f2.applyLocalizedPattern(null);
            fail("Expected NullPointerException for null pattern");
        } catch (NullPointerException e) {
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.