Package java.text

Examples of java.text.SimpleDateFormat.toPattern()


                .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 {
            f2.applyLocalizedPattern("b");
View Full Code Here


    public void test_applyPatternLjava_lang_String() {
        // Test for method void
        // java.text.SimpleDateFormat.applyPattern(java.lang.String)
        SimpleDateFormat f2 = new SimpleDateFormat("y", new Locale("de", "CH"));
        f2.applyPattern("GyMdkHmsSEDFwWahKz");
        assertEquals("Wrong pattern", "GyMdkHmsSEDFwWahKz", f2.toPattern());

        // test invalid patterns
        try {
            f2.applyPattern("b");
            fail("Expected IllegalArgumentException for pattern with invalid patter letter: b");
View Full Code Here

      DateFormat dateFormat = getDateFormat(
          converter.getType(), converter.getDateStyle(),
          converter.getTimeStyle(), converter.getLocale());
      if (dateFormat instanceof SimpleDateFormat) {
        SimpleDateFormat format = (SimpleDateFormat) dateFormat;
        pattern = format.toPattern();
      }
    }

    return pattern;
  }
View Full Code Here

        {

            if(popupDateFormat == null)
            {
                SimpleDateFormat defaultDateFormat = createStandardDateFormat(facesContext);
                popupDateFormat = defaultDateFormat.toPattern();
            }

            return popupDateFormat;
        }
View Full Code Here

            {
              final SimpleDateFormat df = (SimpleDateFormat) subFormats[sdf];

              final String[] fields = fmt.getFields();
              visualElement.setAttribute(CORE_NAMESPACE, FIELD_ATTRIBUTE, fields[sdf]);
              visualElement.setAttribute(CORE_NAMESPACE, FORMAT_ATTRIBUTE, df.toPattern());
            }
          }
          else if (targetElementType instanceof NumberFieldType)
          {
            final int sdf = findFirstNumberFormat(subFormats);
View Full Code Here

            {
              final DecimalFormat df = (DecimalFormat) subFormats[sdf];

              final String[] fields = fmt.getFields();
              visualElement.setAttribute(CORE_NAMESPACE, FIELD_ATTRIBUTE, fields[sdf]);
              visualElement.setAttribute(CORE_NAMESPACE, FORMAT_ATTRIBUTE, df.toPattern());
            }
          }
          else
          {
            final String[] fields = fmt.getFields();
View Full Code Here

  private static void printDate(final Properties writer, int type, Locale locale)
  {
    SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getDateInstance(type, locale);

    writer.put ("format.date." + typeToString(type) ,sdf.toPattern());
  }

  private static void printTime(final Properties writer, int type, Locale locale)
  {
    SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getTimeInstance(type, locale);
View Full Code Here

  }

  private static void printTime(final Properties writer, int type, Locale locale)
  {
    SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getTimeInstance(type, locale);
    writer.put ("format.time." + typeToString(type) , sdf.toPattern());
  }
}
View Full Code Here

  public void setParameterFromObject(final Object o)
      throws ObjectFactoryException
  {
    super.setParameterFromObject(o);
    final SimpleDateFormat format = (SimpleDateFormat) o;
    setParameter("pattern", format.toPattern());
  }

  /**
   * Creates an object based on this description.
   *
 
View Full Code Here

        DateField df = new DateField();
        df.injectMessages(messages);

        SimpleDateFormat format = df.toJavaDateFormat();

        assertEquals(format.toPattern(), "MM/dd/yy");
    }

    @Test
    public void convert_symbol_non_default() throws Exception
    {
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.