Package java.text

Examples of java.text.SimpleDateFormat.toPattern()


   */
  public void test(TestHarness harness)
  {
    SimpleDateFormat f = new SimpleDateFormat("yyyy", Locale.FRENCH);
    f.applyPattern("d-MMM-yyyy");
    harness.check(f.toPattern(), "d-MMM-yyyy");
   
    // try invalid argument
    try
    {
      f.applyPattern("XYZ");
View Full Code Here


  public String getFormatString()
  {
    if (getFormat() instanceof SimpleDateFormat)
    {
      final SimpleDateFormat decFormat = (SimpleDateFormat) getFormat();
      return decFormat.toPattern();
    }
    return null;
  }

  /**
 
View Full Code Here

        element.setAttributeExpression(AttributeNames.Core.NAMESPACE, AttributeNames.Core.VALUE, formulaExpression);
      }
      if (format != null)
      {
        final SimpleDateFormat simpleDateFormat = (SimpleDateFormat) format;
        final String formatString = simpleDateFormat.toPattern();
        element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.FORMAT_STRING, formatString);
      }
      element.setAttribute(AttributeNames.Core.NAMESPACE, AttributeNames.Core.NULL_VALUE, getNullString());
    }
    else
View Full Code Here

      // this includes timestamp ..
      final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, context.getLocale());
      if (dateFormat instanceof SimpleDateFormat)
      {
        final SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
        return sdf.toPattern();
      }
      // we cannot come up with a sensible default ..
      return null;
    }
    else if (Time.class.isAssignableFrom(type))
View Full Code Here

      // this includes timestamp ..
      final DateFormat dateFormat = DateFormat.getTimeInstance(DateFormat.DEFAULT, context.getLocale());
      if (dateFormat instanceof SimpleDateFormat)
      {
        final SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
        return sdf.toPattern();
      }
      // we cannot come up with a sensible default ..
      return null;
    }
    else if (Date.class.isAssignableFrom(type))
View Full Code Here

      final DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT,
          context.getLocale());
      if (dateFormat instanceof SimpleDateFormat)
      {
        final SimpleDateFormat sdf = (SimpleDateFormat) dateFormat;
        return sdf.toPattern();
      }
      // we cannot come up with a sensible default ..
      return null;
    }
    else if (Number.class.isAssignableFrom(type))
View Full Code Here

     */
    public TimeFormat getTimeFormat() {
        if (currentTimeFormat == null) {
            SimpleDateFormat f = (SimpleDateFormat) SimpleDateFormat
                    .getTimeInstance(SimpleDateFormat.SHORT, getLocale());
            String p = f.toPattern();
            if (p.indexOf("HH") != -1 || p.indexOf("H") != -1) {
                return TimeFormat.Format24H;
            }
            return TimeFormat.Format12H;
        }
View Full Code Here

        {

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

            StringBuffer jsPopupDateFormat = new StringBuffer();

            for(int i=0;i<popupDateFormat.length();i++)
View Full Code Here

                locale = Locale.getDefault();
            }

            try {
                SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateInstance(style, locale);
                String pattern = formatter.toPattern();
                format = getInstance(pattern, timeZone, locale);
                cDateInstanceCache.put(key, format);
               
            } catch (ClassCastException ex) {
                throw new IllegalArgumentException("No date pattern for locale: " + locale);
View Full Code Here

                locale = Locale.getDefault();
            }

            try {
                SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getTimeInstance(style, locale);
                String pattern = formatter.toPattern();
                format = getInstance(pattern, timeZone, locale);
                cTimeInstanceCache.put(key, format);
           
            } catch (ClassCastException ex) {
                throw new IllegalArgumentException("No date pattern for locale: " + locale);
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.