/** * <p>Gets a formatter instance using the specified pattern in the * default locale.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(String pattern) { return getInstance(pattern, null, null); }
/** * <p>Gets a formatter instance using the specified pattern and * locale.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @param locale optional locale, overrides system locale * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(String pattern, Locale locale) { return getInstance(pattern, null, locale); }
/** * <p>Gets a formatter instance using the specified pattern and * time zone.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @param timeZone optional time zone, overrides time zone of * formatted date * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(String pattern, TimeZone timeZone) { return getInstance(pattern, timeZone, null); }
/** * <p>Gets a formatter instance using the default pattern in the * default locale.</p> * * @return a date/time formatter */ public static FastDateFormat getInstance() { return getInstance(getDefaultPattern(), null, null); }
/** * <p>Formats a date/time into a specific pattern in a time zone and locale.</p> * * @param date the date to format * @param pattern the pattern to use to format the date * @param timeZone the time zone to use, may be <code>null</code> * @param locale the locale to use, may be <code>null</code> * @return the formatted date */ public static String format(Date date, String pattern, TimeZone timeZone, Locale locale) { FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); return df.format(date); }
/** * <p>Formats a calendar into a specific pattern in a time zone and locale.</p> * * @param calendar the calendar to format * @param pattern the pattern to use to format the calendar * @param timeZone the time zone to use, may be <code>null</code> * @param locale the locale to use, may be <code>null</code> * @return the formatted calendar * @see FastDateFormat#format(Calendar) * @since 2.4 */ public static String format(Calendar calendar, String pattern, TimeZone timeZone, Locale locale) { FastDateFormat df = FastDateFormat.getInstance(pattern, timeZone, locale); return df.format(calendar); }
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getDateInstance(style, locale); String pattern = formatter.toPattern(); format = getInstance(pattern, timeZone, locale); cDateInstanceCache.put(key, format);
SimpleDateFormat formatter = (SimpleDateFormat) DateFormat.getTimeInstance(style, locale); String pattern = formatter.toPattern(); format = getInstance(pattern, timeZone, locale); cTimeInstanceCache.put(key, format);
locale); String pattern = formatter.toPattern(); format = getInstance(pattern, timeZone, locale); cDateTimeInstanceCache.put(key, format);
@Override public void configure(Context context) { String dateFormatString = context.getString(DATE_FORMAT); String timeZoneString = context.getString(TIME_ZONE); if (StringUtils.isBlank(dateFormatString)) { dateFormatString = DEFAULT_DATE_FORMAT; } if (StringUtils.isBlank(timeZoneString)) { timeZoneString = DEFAULT_TIME_ZONE; } fastDateFormat = FastDateFormat.getInstance(dateFormatString, TimeZone.getTimeZone(timeZoneString)); indexPrefix = context.getString(ElasticSearchSinkConstants.INDEX_NAME); }
public static Format getDateFormatter(String pattern) { return DateUtil.DEFAULT_DATE_FORMAT.equals(pattern) ? DateUtil.DEFAULT_DATE_FORMATTER : FastDateFormat.getInstance(pattern, DateUtil.DATE_TIME_ZONE); }
/** * <p>Gets a formatter instance using the specified pattern in the * default locale.</p> * * @param pattern {@link java.text.SimpleDateFormat} compatible * pattern * @return a pattern based date/time formatter * @throws IllegalArgumentException if pattern is invalid */ public static FastDateFormat getInstance(String pattern) { return getInstance(pattern, null, null); }
public static Format getTimeFormatter(String pattern) { return DateUtil.DEFAULT_TIME_FORMAT.equals(pattern) ? DateUtil.DEFAULT_TIME_FORMATTER : FastDateFormat.getInstance(pattern, DateUtil.DEFAULT_TIME_ZONE); }
/** * Default constructor. */ public DateMarshaller() { this(FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("GMT"), Locale.US)); }
/** * <p>Gets a formatter instance using the default pattern in the * default locale.</p> * * @return a date/time formatter */ public static FastDateFormat getInstance() { return getInstance(getDefaultPattern(), null, null); }
/** * Returns a formatter for this date format. * * @return A formatter. */ public FastDateFormat getFormatter() { boolean ignoreTime = this == WITHOUT_TIME || this == HL7_WITHOUT_TIME; return FastDateFormat.getInstance(pattern, ignoreTime ? TimeZone.getDefault() : getLocalTimeZone()); }
/** * <p>Gets a formatter instance using the default pattern in the * default locale.</p> * * @return a date/time formatter */ public static FastDateFormat getInstance() { return getInstance(getDefaultPattern(), null, null); }
/** * <p>Gets a formatter instance using the default pattern in the * default locale.</p> * * @return a date/time formatter */ public static FastDateFormat getInstance() { return getInstance(getDefaultPattern(), null, null); }
/** * <p>Gets a formatter instance using the default pattern in the * default locale.</p> * * @return a date/time formatter */ public static FastDateFormat getInstance() { return getInstance(getDefaultPattern(), null, null); }
@PropertySetter("format") public void setFormat(String format) { if (!areEqual(format = trimify(format), this.format)) { this.format = format; formatter = format == null ? FastDateFormat.getDateInstance(FastDateFormat.SHORT) : FastDateFormat.getInstance(format); } }