Package com.ibm.icu.text

Examples of com.ibm.icu.text.SimpleDateFormat


            return ConversionResult.create("date." + this.variant);
        }
    }

    public String convertToString(Object value, Locale locale, Convertor.FormatCache formatCache) {
        SimpleDateFormat dateFormat = getDateFormat(locale, formatCache);
        return dateFormat.format((Date)value);
    }
View Full Code Here


        SimpleDateFormat dateFormat = getDateFormat(locale, formatCache);
        return dateFormat.format((Date)value);
    }

    private final SimpleDateFormat getDateFormat(Locale locale, Convertor.FormatCache formatCache) {
        SimpleDateFormat dateFormat = null;
        if (formatCache != null)
            dateFormat = (SimpleDateFormat)formatCache.get();
        if (dateFormat == null) {
            dateFormat = getDateFormat(locale);
            if (formatCache != null)
                formatCache.store(dateFormat);
        }
        dateFormat.setLenient(lenient);
        return dateFormat;
    }
View Full Code Here

        dateFormat.setLenient(lenient);
        return dateFormat;
    }

    protected SimpleDateFormat getDateFormat(Locale locale) {
        SimpleDateFormat dateFormat = null;

        if (this.variant.equals(DATE)) {
            //dateFormat = I18nSupport.getInstance().getDateFormat(style, locale);
            dateFormat = (SimpleDateFormat)DateFormat.getDateInstance(style, locale);
        } else if (this.variant.equals(TIME)) {
            //dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale);
            dateFormat = (SimpleDateFormat)DateFormat.getTimeInstance(style, locale);
        } else if (this.variant.equals(DATE_TIME)) {
            //dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale);
            dateFormat = (SimpleDateFormat)DateFormat.getDateTimeInstance(style, style, locale);
        }

        String pattern = (String)localizedPatterns.get(locale);

        if (pattern != null)
            // Note: this was previously using applyLocalizedPattern() which allows to use
            // a locale-specific pattern syntax, e.g. in french "j" (jour) for "d" and
            // "a" (annee) for "y". But the localized pattern syntax is very little known and thus
            // led to some weird pattern syntax error messages.
            dateFormat.applyPattern(pattern);
        else if (nonLocalizedPattern != null)
            dateFormat.applyPattern(nonLocalizedPattern);

        dateFormat.setLenient(lenient);
        return dateFormat;
    }
View Full Code Here

  }

  private UpdateContainer generateRDF(Workspace workspace) {
   
    // Prepare the file path and names
    SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy-kkmmssS");
    String ts = sdf.format(Calendar.getInstance().getTime());
    final String rdfFileName = workspace.getCommandPreferencesId() + worksheetId + "-" + ts+ ".ttl";
   
    generatedRDFFileName = ServletContextParameterMap.getParameterValue(ContextParameter.RDF_PUBLISH_DIR) + rdfFileName;
   
    final String graphUri = "http://localhost/"+workspace.getCommandPreferencesId() + "/" + worksheetId + "/" + ts;
View Full Code Here

      @JsonProperty("timeFormat") String timeFormat,
      @JsonProperty("resultFormat") String resultFormat
  )
  {
    this.timeFormat = timeFormat;
    this.timeFormatter = new SimpleDateFormat(timeFormat);
    this.timeFormatter.setLenient(true);

    this.resultFormat = resultFormat;
    this.resultFormatter = new SimpleDateFormat(resultFormat);
  }
View Full Code Here

                case TEXT:
                    // Dummy format so no need to check it for problems.
                    uFormat = new TextFormat();
                    break;
                case DATE:
                    uFormat = new SimpleDateFormat(pattern, locale);
                    ((SimpleDateFormat) uFormat).setTimeZone(TimeZone.getTimeZone("GMT"));
                    uFormat.format(new DateValue(1995, 7, 3).getObjectToFormat());
                    break;
                case TIMEOFDAY:
                    uFormat = new SimpleDateFormat(pattern, locale);
                    ((SimpleDateFormat) uFormat).setTimeZone(TimeZone.getTimeZone("GMT"));
                    uFormat.format(new TimeOfDayValue(2, 59, 12, 123).getObjectToFormat());
                    break;
                case DATETIME:
                    uFormat = new SimpleDateFormat(pattern, locale);
                    ((SimpleDateFormat) uFormat).setTimeZone(TimeZone.getTimeZone("GMT"));
                    uFormat.format(new DateTimeValue(1995, 7, 3, 2, 59, 12, 123).getObjectToFormat());
                    break;
                case NUMBER:
                    DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale);
View Full Code Here

        this.localizedPatterns = new LocaleMap();
        this.lenient = true;
    }

    public ConversionResult convertFromString(String value, Locale locale, Convertor.FormatCache formatCache) {
        SimpleDateFormat dateFormat = getDateFormat(locale, formatCache);
        try {
            return new ConversionResult(dateFormat.parse(value));
        } catch (ParseException e) {
            return ConversionResult.create("date." + this.variant);
        }
    }
View Full Code Here

            return ConversionResult.create("date." + this.variant);
        }
    }

    public String convertToString(Object value, Locale locale, Convertor.FormatCache formatCache) {
        SimpleDateFormat dateFormat = getDateFormat(locale, formatCache);
        return dateFormat.format((Date)value);
    }
View Full Code Here

        SimpleDateFormat dateFormat = getDateFormat(locale, formatCache);
        return dateFormat.format((Date)value);
    }

    private final SimpleDateFormat getDateFormat(Locale locale, Convertor.FormatCache formatCache) {
        SimpleDateFormat dateFormat = null;
        if (formatCache != null)
            dateFormat = (SimpleDateFormat)formatCache.get();
        if (dateFormat == null) {
            dateFormat = getDateFormat(locale);
            if (formatCache != null)
                formatCache.store(dateFormat);
        }
        dateFormat.setLenient(lenient);
        return dateFormat;
    }
View Full Code Here

        dateFormat.setLenient(lenient);
        return dateFormat;
    }

    protected SimpleDateFormat getDateFormat(Locale locale) {
        SimpleDateFormat dateFormat = null;

        if (this.variant.equals(DATE)) {
            //dateFormat = I18nSupport.getInstance().getDateFormat(style, locale);
            dateFormat = (SimpleDateFormat)DateFormat.getDateInstance(style, locale);
        } else if (this.variant.equals(TIME)) {
            //dateFormat = I18nSupport.getInstance().getTimeFormat(style, locale);
            dateFormat = (SimpleDateFormat)DateFormat.getTimeInstance(style, locale);
        } else if (this.variant.equals(DATE_TIME)) {
            //dateFormat = I18nSupport.getInstance().getDateTimeFormat(style, style, locale);
            dateFormat = (SimpleDateFormat)DateFormat.getDateTimeInstance(style, style, locale);
        }

        String pattern = (String)localizedPatterns.get(locale);

        if (pattern != null)
            // Note: this was previously using applyLocalizedPattern() which allows to use
            // a locale-specific pattern syntax, e.g. in french "j" (jour) for "d" and
            // "a" (annee) for "y". But the localized pattern syntax is very little known and thus
            // led to some weird pattern syntax error messages.
            dateFormat.applyPattern(pattern);
        else if (nonLocalizedPattern != null)
            dateFormat.applyPattern(nonLocalizedPattern);

        dateFormat.setLenient(lenient);
        return dateFormat;
    }
View Full Code Here

TOP

Related Classes of com.ibm.icu.text.SimpleDateFormat

Copyright © 2018 www.massapicom. 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.