public class FastDateFormat extends Format implements DateParser, DatePrinter
Format.Field
Modifier | Constructor and Description |
---|---|
protected |
FastDateFormat(String pattern,
TimeZone timeZone,
Locale locale) |
protected |
FastDateFormat(String pattern,
TimeZone timeZone,
Locale locale,
Date centuryStart) |
clone, format, formatToCharacterIterator, parseObject
public static FastDateFormat getInstance()
public static FastDateFormat getInstance(String pattern)
public static FastDateFormat getInstance(String pattern, TimeZone timeZone)
public static FastDateFormat getInstance(String pattern, Locale locale)
public static FastDateFormat getInstance(String pattern, TimeZone timeZone, Locale locale)
pattern
- patterntimeZone
- timeZonelocale
- localepublic static FastDateFormat getDateInstance(int style)
public static FastDateFormat getDateInstance(int style, Locale locale)
public static FastDateFormat getDateInstance(int style, TimeZone timeZone)
public static FastDateFormat getDateInstance(int style, TimeZone timeZone, Locale locale)
style
- styletimeZone
- timeZonelocale
- localepublic static FastDateFormat getTimeInstance(int style)
public static FastDateFormat getTimeInstance(int style, Locale locale)
public static FastDateFormat getTimeInstance(int style, TimeZone timeZone)
public static FastDateFormat getTimeInstance(int style, TimeZone timeZone, Locale locale)
style
- styletimeZone
- timeZonelocale
- localepublic static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle)
public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone)
public static FastDateFormat getDateTimeInstance(int dateStyle, int timeStyle, TimeZone timeZone, Locale locale)
dateStyle
- dateStyletimeStyle
- timeStyletimeZone
- timeZonelocale
- localepublic StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
public String format(long millis)
DatePrinter
format
in interface DatePrinter
millis
- 毫秒public String format(Date date)
DatePrinter
format
in interface DatePrinter
date
- 时间public String format(Calendar calendar)
DatePrinter
format
in interface DatePrinter
calendar
- calendarpublic Date parse(String source)
DateParser
parse
in interface DateParser
source
- 时间public Date parse(String source, ParsePosition pos)
DateParser
parse
in interface DateParser
source
- 时间pos
- 位置public boolean parse(String source, ParsePosition pos, Calendar calendar)
DateParser
parse
in interface DateParser
source
- 时间pos
- 位置calendar
- 日历public Object parseObject(String source, ParsePosition pos)
parseObject
in class Format
public String getPattern()
DateParser
getPattern
in interface DateParser
getPattern
in interface DatePrinter
public TimeZone getTimeZone()
DateParser
getTimeZone
in interface DateParser
getTimeZone
in interface DatePrinter
public Locale getLocale()
DateParser
getLocale
in interface DateParser
getLocale
in interface DatePrinter
public int getMaxLengthEstimate()
Copyright © 2024. All rights reserved.