public class FastDateFormat extends Object
Similar to SimpleDateFormat
, but faster and thread-safe.
Only formatting is supported, but all patterns are compatible with
SimpleDateFormat.
Note, this class is from the open source Tea project (http://sourceforge.net/projects/teatrove/).
Modifier and Type | Field and Description |
---|---|
static Object |
FULL
Style pattern
|
static Object |
LONG
Style pattern
|
static Object |
MEDIUM
Style pattern
|
static Object |
SHORT
Style pattern
|
public static final Object FULL
public static final Object LONG
public static final Object MEDIUM
public static final Object SHORT
public static FastDateFormat getInstance()
public static FastDateFormat getInstance(String pattern) throws IllegalArgumentException
pattern
- SimpleDateFormat
compatible patternIllegalArgumentException
public static FastDateFormat getInstance(String pattern, TimeZone timeZone) throws IllegalArgumentException
pattern
- SimpleDateFormat
compatible patterntimeZone
- optional time zone, overrides time zone of formatted
dateIllegalArgumentException
public static FastDateFormat getInstance(String pattern, Locale locale) throws IllegalArgumentException
pattern
- SimpleDateFormat
compatible patternlocale
- optional locale, overrides system localeIllegalArgumentException
public static FastDateFormat getInstance(String pattern, DateFormatSymbols symbols) throws IllegalArgumentException
pattern
- SimpleDateFormat
compatible patternsymbols
- optional date format symbols, overrides symbols for
system localeIllegalArgumentException
public static FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale) throws IllegalArgumentException
pattern
- SimpleDateFormat
compatible patterntimeZone
- optional time zone, overrides time zone of formatted
datelocale
- optional locale, overrides system localeIllegalArgumentException
public static FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale, DateFormatSymbols symbols) throws IllegalArgumentException
pattern
- SimpleDateFormat
compatible patterntimeZone
- optional time zone, overrides time zone of formatted
datelocale
- optional locale, overrides system localesymbols
- optional date format symbols, overrides symbols for
provided localeIllegalArgumentException
public static FastDateFormat getDateInstance(Object style, TimeZone timeZone, Locale locale) throws IllegalArgumentException
style
- date style: FULL, LONG, MEDIUM, or SHORTtimeZone
- optional time zone, overrides time zone of formatted
datelocale
- optional locale, overrides system localeIllegalArgumentException
public static FastDateFormat getTimeInstance(Object style, TimeZone timeZone, Locale locale) throws IllegalArgumentException
style
- time style: FULL, LONG, MEDIUM, or SHORTtimeZone
- optional time zone, overrides time zone of formatted
datelocale
- optional locale, overrides system localeIllegalArgumentException
public static FastDateFormat getDateTimeInstance(Object dateStyle, Object timeStyle, TimeZone timeZone, Locale locale) throws IllegalArgumentException
dateStyle
- date style: FULL, LONG, MEDIUM, or SHORTtimeStyle
- time style: FULL, LONG, MEDIUM, or SHORTtimeZone
- optional time zone, overrides time zone of formatted
datelocale
- optional locale, overrides system localeIllegalArgumentException
public StringBuffer format(Date date, StringBuffer buf)
public StringBuffer format(Calendar calendar, StringBuffer buf)
public String getPattern()
public TimeZone getTimeZone()
public Locale getLocale()
public int getMaxLengthEstimate()
Copyright © 2003–2019 Ignite Realtime. All rights reserved.