Package java.text

Examples of java.text.SimpleDateFormat.toPattern()


        df.injectMessages(messages);
        df.injectFormat("%d %b %Y");

        SimpleDateFormat format = df.toJavaDateFormat();

        assertEquals(format.toPattern(), "dd MMM yyyy");
    }

    @Test
    public void unknown_symbol() throws Exception
    {
View Full Code Here


      dateFormat = (SimpleDateFormat) DateFormat.getDateTimeInstance(
          DATE_STYLE, TIME_STYLE, LOCALE);
     
      // not all date patterns includes era, full year, timezone and second,
      // so we add them here
      dateFormat.applyPattern(dateFormat.toPattern() + " G s Z yyyy");
      dateFormat.setTimeZone(TIMEZONE);
     
      DATE_FORMAT = new NumberDateFormat(dateFormat);
     
      do {
View Full Code Here

        {

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

            return popupDateFormat;
        }
View Full Code Here

    }
   
    public static Date parseDate(String date)
    {
      SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
        if (date==null || date.length()!=dateFormat.toPattern().length())
        {   // Error: Invalid Date supplied. Using Today
            log.error("Invalid date format: " + String.valueOf(date));
            return DateUtils.getDateNow();
        }
        try
View Full Code Here

        if (shortDateFormat instanceof SimpleDateFormat)
        {
            SimpleDateFormat simpleDateFormat = (SimpleDateFormat) shortDateFormat;

            String pattern = simpleDateFormat.toPattern();

            String revised = pattern.replaceAll("([^y])yy$", "$1yyyy");

            return new SimpleDateFormat(revised);
        }
View Full Code Here

    catch (IllegalArgumentException iae)
      {
  harness.debug(iae);
  harness.check(false);
      }
    harness.check(f.toPattern(), "d-MMM-yyyy");
    // try invalid argument
    try
    {
      f.applyLocalizedPattern("XYZ");
View Full Code Here

   * @param harness  the test harness (<code>null</code> not allowed).
   */
  public void test(TestHarness harness)
  {
    SimpleDateFormat f = new SimpleDateFormat("yyyy", Locale.FRENCH);
    harness.check(f.toPattern(), "yyyy");
    f.applyPattern("d-MMM-yyyy");
    harness.check(f.toPattern(), "d-MMM-yyyy");
  }

}
View Full Code Here

  public void test(TestHarness harness)
  {
    SimpleDateFormat f = new SimpleDateFormat("yyyy", Locale.FRENCH);
    harness.check(f.toPattern(), "yyyy");
    f.applyPattern("d-MMM-yyyy");
    harness.check(f.toPattern(), "d-MMM-yyyy");
  }

}
View Full Code Here

      {
  harness.debug(e);
  harness.check(false);
      }
    String local = format.getDateFormatSymbols().getLocalPatternChars();
    harness.check(format.toPattern(), pattern, "Non-localized pattern " +
      "comes back as is with toPattern().");
    String localizedPattern = translateLocalizedPattern(pattern,
              standard,
              local);
    harness.check(format.toLocalizedPattern(), localizedPattern,
View Full Code Here

      }
    local = format.getDateFormatSymbols().getLocalPatternChars();
    harness.check(format.toLocalizedPattern(), localizedPattern,
      "Localized pattern comes back as is with " +
      "toLocalizedPattern().");
    harness.check(format.toPattern(), pattern,
      "Localized pattern comes back standardised with " +
      "toPattern().");
  }

  /* Taken from GNU Classpath's java.text.SimpleDateFormat */
 
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.