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
|
Modifier and Type | Method and Description |
---|---|
String |
format(Calendar calendar) |
StringBuffer |
format(Calendar calendar,
StringBuffer buf) |
String |
format(Date date) |
StringBuffer |
format(Date date,
StringBuffer buf) |
static FastDateFormat |
getDateInstance(Object style,
TimeZone timeZone,
Locale locale) |
static FastDateFormat |
getDateTimeInstance(Object dateStyle,
Object timeStyle,
TimeZone timeZone,
Locale locale) |
static FastDateFormat |
getInstance() |
static FastDateFormat |
getInstance(String pattern) |
static FastDateFormat |
getInstance(String pattern,
DateFormatSymbols symbols) |
static FastDateFormat |
getInstance(String pattern,
Locale locale) |
static FastDateFormat |
getInstance(String pattern,
TimeZone timeZone) |
static FastDateFormat |
getInstance(String pattern,
TimeZone timeZone,
Locale locale) |
static FastDateFormat |
getInstance(String pattern,
TimeZone timeZone,
Locale locale,
DateFormatSymbols symbols) |
Locale |
getLocale() |
int |
getMaxLengthEstimate()
Returns an estimate for the maximum length date that this date
formatter will produce.
|
String |
getPattern() |
static FastDateFormat |
getTimeInstance(Object style,
TimeZone timeZone,
Locale locale) |
TimeZone |
getTimeZone()
Returns the time zone used by this formatter, or null if time zone of
formatted dates is used instead.
|
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-2008 Jive Software.