public class GenericFormatter extends AbstractFormatter implements DateFormatter
Modifier and Type | Field and Description |
---|---|
static GenericFormatter |
ANSIC_FORMATTER |
private static java.text.DecimalFormat |
D2 |
private java.text.SimpleDateFormat |
dateFormat |
static java.text.SimpleDateFormat |
FORMAT_ANSIC |
static java.text.SimpleDateFormat |
FORMAT_RFC1123_SHORT |
static java.text.SimpleDateFormat |
FORMAT_SHORT_DAY |
static java.text.SimpleDateFormat |
FORMAT_SHORT_MILSEC |
static java.text.SimpleDateFormat |
FORMAT_SHORT_MINUTE |
static java.text.SimpleDateFormat |
FORMAT_SHORT_SECOND |
static java.text.SimpleDateFormat |
FORMAT_SIMPLE |
private long |
maxCacheDiff |
static java.lang.String |
PATTERN_ANSIC |
static java.lang.String |
PATTERN_RFC1123_SHORT |
static java.lang.String |
PATTERN_SHORT_DAY |
static java.lang.String |
PATTERN_SHORT_MILSEC |
static java.lang.String |
PATTERN_SHORT_MINUTE |
static java.lang.String |
PATTERN_SHORT_SECOND |
static java.lang.String |
PATTERN_SIMPLE |
static GenericFormatter |
RFC1123_SHORT_FORMATTER |
static GenericFormatter |
SHORT_DAY_FORMATTER |
static GenericFormatter |
SHORT_MILSEC_FORMATTER |
static GenericFormatter |
SHORT_MINUTE_FORMATTER |
static GenericFormatter |
SHORT_SECOND_FORMATTER |
static GenericFormatter |
SIMPLE_FORMATTER |
static long |
time_day |
static long |
time_hour |
static long |
time_minute |
static long |
time_second |
dayMillis, hourMillis, last_format, last_time, leapyearMillis, minuteMillis, monthAverageMillis, normalyearMillis, secondMillis, testCalendar, UTCCalendar, UTCtimeZone
Constructor and Description |
---|
GenericFormatter(java.text.SimpleDateFormat dateFormat,
long maxCacheDiff) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
format() |
java.lang.String |
format(java.util.Date date)
Note: The short day format doesn't include any timezone information.
|
static void |
main(java.lang.String[] args) |
java.util.Calendar |
parse(java.lang.String timeString,
int timezoneOffset)
Parse a String representation of a Date in short day format assuming the date
is aligned to the GMT/UTC timezone.
|
java.util.Calendar |
parse(java.lang.String timeString,
java.lang.String UTCOffset)
Like
#parseShortSecond(String) using additional timezone information provided in an
offset String, like "+0100" for CET. |
private static long |
UTCDiff()
get the difference of this servers time zone to UTC/GMT in milliseconds
|
private static int |
UTCDiff(java.lang.String diffString) |
static java.lang.String |
UTCDiffString() |
public static final java.lang.String PATTERN_SHORT_DAY
public static final java.lang.String PATTERN_SHORT_MINUTE
public static final java.lang.String PATTERN_SHORT_SECOND
public static final java.lang.String PATTERN_SHORT_MILSEC
public static final java.lang.String PATTERN_RFC1123_SHORT
public static final java.lang.String PATTERN_ANSIC
public static final java.lang.String PATTERN_SIMPLE
public static final java.text.SimpleDateFormat FORMAT_SHORT_DAY
public static final java.text.SimpleDateFormat FORMAT_SHORT_MINUTE
public static final java.text.SimpleDateFormat FORMAT_SHORT_SECOND
public static final java.text.SimpleDateFormat FORMAT_SHORT_MILSEC
public static final java.text.SimpleDateFormat FORMAT_RFC1123_SHORT
public static final java.text.SimpleDateFormat FORMAT_ANSIC
public static final java.text.SimpleDateFormat FORMAT_SIMPLE
public static final long time_second
public static final long time_minute
public static final long time_hour
public static final long time_day
public static final GenericFormatter SHORT_DAY_FORMATTER
public static final GenericFormatter SHORT_MINUTE_FORMATTER
public static final GenericFormatter SHORT_SECOND_FORMATTER
public static final GenericFormatter SHORT_MILSEC_FORMATTER
public static final GenericFormatter RFC1123_SHORT_FORMATTER
public static final GenericFormatter ANSIC_FORMATTER
public static final GenericFormatter SIMPLE_FORMATTER
private final java.text.SimpleDateFormat dateFormat
private final long maxCacheDiff
private static final java.text.DecimalFormat D2
public GenericFormatter(java.text.SimpleDateFormat dateFormat, long maxCacheDiff)
public java.lang.String format(java.util.Date date)
#formatShortDay(TimeZone)
format
in interface DateFormatter
format
in class AbstractFormatter
public java.lang.String format()
format
in interface DateFormatter
format
in class AbstractFormatter
public java.util.Calendar parse(java.lang.String timeString, int timezoneOffset) throws java.text.ParseException
parse
in interface DateFormatter
parse
in class AbstractFormatter
java.text.ParseException
- The exception is thrown if an error occured during while parsing
the String.#formatShortDay()
public java.util.Calendar parse(java.lang.String timeString, java.lang.String UTCOffset) throws java.text.ParseException
#parseShortSecond(String)
using additional timezone information provided in an
offset String, like "+0100" for CET.java.text.ParseException
private static int UTCDiff(java.lang.String diffString)
private static long UTCDiff()
public static java.lang.String UTCDiffString()
public static void main(java.lang.String[] args)