org.jfree.chart.util
Class RelativeDateFormat
DateFormat
org.jfree.chart.util.RelativeDateFormat
A formatter that formats dates to show the elapsed time relative to some
base date.
Object | clone() - Returns a clone of this instance.
|
boolean | equals(Object obj) - Tests this formatter for equality with an arbitrary object.
|
StringBuffer | format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) - Formats the given date as the amount of elapsed time (relative to the
base date specified in the constructor).
|
long | getBaseMillis() - Returns the base date/time used to calculate the elapsed time for
display.
|
String | getDaySuffix() - Returns the string that is appended to the day count.
|
String | getHourSuffix() - Returns the string that is appended to the hour count.
|
String | getMinuteSuffix() - Returns the string that is appended to the minute count.
|
String | getSecondSuffix() - Returns the string that is appended to the second count.
|
boolean | getShowZeroDays() - Returns the flag that controls whether or not zero day counts are
shown in the formatted output.
|
int | hashCode() - Returns a hash code for this instance.
|
static void | main(String[] args) - Some test code.
|
Date | parse(String source, ParsePosition pos) - Parses the given string (not implemented).
|
void | setBaseMillis(long baseMillis) - Sets the base date/time used to calculate the elapsed time for display.
|
void | setDaySuffix(String suffix) - Sets the string that is appended to the day count.
|
void | setHourSuffix(String suffix) - Sets the string that is appended to the hour count.
|
void | setMinuteSuffix(String suffix) - Sets the string that is appended to the minute count.
|
void | setSecondFormatter(NumberFormat formatter) - Sets the formatter for the seconds and milliseconds.
|
void | setSecondSuffix(String suffix) - Sets the string that is appended to the second count.
|
void | setShowZeroDays(boolean show) - Sets the flag that controls whether or not zero day counts are shown
in the formatted output.
|
RelativeDateFormat
public RelativeDateFormat(Date time)
Creates a new instance.
time
- the date/time (null
not permitted).
RelativeDateFormat
public RelativeDateFormat(long baseMillis)
Creates a new instance.
baseMillis
- the time zone (null
not permitted).
clone
public Object clone()
Returns a clone of this instance.
equals
public boolean equals(Object obj)
Tests this formatter for equality with an arbitrary object.
obj
- the object (null
permitted).
format
public StringBuffer format(Date date,
StringBuffer toAppendTo,
FieldPosition fieldPosition)
Formats the given date as the amount of elapsed time (relative to the
base date specified in the constructor).
date
- the date.toAppendTo
- the string buffer.fieldPosition
- the field position.
getBaseMillis
public long getBaseMillis()
Returns the base date/time used to calculate the elapsed time for
display.
- The base date/time in milliseconds since 1-Jan-1970.
getDaySuffix
public String getDaySuffix()
Returns the string that is appended to the day count.
getHourSuffix
public String getHourSuffix()
Returns the string that is appended to the hour count.
getMinuteSuffix
public String getMinuteSuffix()
Returns the string that is appended to the minute count.
getSecondSuffix
public String getSecondSuffix()
Returns the string that is appended to the second count.
getShowZeroDays
public boolean getShowZeroDays()
Returns the flag that controls whether or not zero day counts are
shown in the formatted output.
hashCode
public int hashCode()
Returns a hash code for this instance.
main
public static void main(String[] args)
Some test code.
parse
public Date parse(String source,
ParsePosition pos)
Parses the given string (not implemented).
source
- the date string.pos
- the parse position.
null
, as this method has not been implemented.
setBaseMillis
public void setBaseMillis(long baseMillis)
Sets the base date/time used to calculate the elapsed time for display.
This should be specified in milliseconds using the same encoding as
java.util.Date
.
baseMillis
- the base date/time in milliseconds.
setDaySuffix
public void setDaySuffix(String suffix)
Sets the string that is appended to the day count.
suffix
- the suffix (null
not permitted).
setHourSuffix
public void setHourSuffix(String suffix)
Sets the string that is appended to the hour count.
suffix
- the suffix (null
not permitted).
setMinuteSuffix
public void setMinuteSuffix(String suffix)
Sets the string that is appended to the minute count.
suffix
- the suffix (null
not permitted).
setSecondFormatter
public void setSecondFormatter(NumberFormat formatter)
Sets the formatter for the seconds and milliseconds.
formatter
- the formatter (null
not permitted).
setSecondSuffix
public void setSecondSuffix(String suffix)
Sets the string that is appended to the second count.
suffix
- the suffix (null
not permitted).
setShowZeroDays
public void setShowZeroDays(boolean show)
Sets the flag that controls whether or not zero day counts are shown
in the formatted output.