Interface DatePrinter
-
- All Known Implementing Classes:
FastDateFormat,FastDatePrinter
public interface DatePrinterDatePrinter is the "missing" interface for the format methods ofDateFormat. You can obtain an object implementing this interface by using one of the FastDateFormat factory methods.Warning: Since binary compatible methods may be added to this interface in any release, developers are not expected to implement this interface.
- Since:
- 3.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.Stringformat(long millis)Formats a millisecondlongvalue.<B extends java.lang.Appendable>
Bformat(long millis, B buf)Formats a millisecondlongvalue into the suppliedAppendable.java.lang.StringBufferformat(long millis, java.lang.StringBuffer buf)Deprecated.Use {format(long, Appendable).java.lang.StringBufferformat(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)Formats aDate,CalendarorLong(milliseconds) object.java.lang.Stringformat(java.util.Calendar calendar)Formats aCalendarobject.<B extends java.lang.Appendable>
Bformat(java.util.Calendar calendar, B buf)Formats aCalendarobject into the suppliedAppendable.java.lang.StringBufferformat(java.util.Calendar calendar, java.lang.StringBuffer buf)Deprecated.java.lang.Stringformat(java.util.Date date)Formats aDateobject using aGregorianCalendar.<B extends java.lang.Appendable>
Bformat(java.util.Date date, B buf)Formats aDateobject into the suppliedAppendableusing aGregorianCalendar.java.lang.StringBufferformat(java.util.Date date, java.lang.StringBuffer buf)Deprecated.Use {format(Date, Appendable).java.util.LocalegetLocale()Gets the locale used by this printer.java.lang.StringgetPattern()Gets the pattern used by this printer.java.util.TimeZonegetTimeZone()Gets the time zone used by this printer.
-
-
-
Method Detail
-
format
java.lang.String format(long millis)
Formats a millisecond
longvalue.- Parameters:
millis- the millisecond value to format- Returns:
- the formatted string
- Since:
- 2.1
-
format
java.lang.String format(java.util.Date date)
Formats a
Dateobject using aGregorianCalendar.- Parameters:
date- the date to format- Returns:
- the formatted string
-
format
java.lang.String format(java.util.Calendar calendar)
Formats a
The TimeZone set on the Calendar is only used to adjust the time offset. The TimeZone specified during the construction of the Parser will determine the TimeZone used in the formatted string.Calendarobject.- Parameters:
calendar- the calendar to format.- Returns:
- the formatted string
-
format
@Deprecated java.lang.StringBuffer format(long millis, java.lang.StringBuffer buf)Deprecated.Use {format(long, Appendable).Formats a millisecond
longvalue into the suppliedStringBuffer.- Parameters:
millis- the millisecond value to formatbuf- the buffer to format into- Returns:
- the specified string buffer
-
format
@Deprecated java.lang.StringBuffer format(java.util.Date date, java.lang.StringBuffer buf)Deprecated.Use {format(Date, Appendable).Formats a
Dateobject into the suppliedStringBufferusing aGregorianCalendar.- Parameters:
date- the date to formatbuf- the buffer to format into- Returns:
- the specified string buffer
-
format
@Deprecated java.lang.StringBuffer format(java.util.Calendar calendar, java.lang.StringBuffer buf)Deprecated.Formats a
The TimeZone set on the Calendar is only used to adjust the time offset. The TimeZone specified during the construction of the Parser will determine the TimeZone used in the formatted string.Calendarobject into the suppliedStringBuffer.- Parameters:
calendar- the calendar to formatbuf- the buffer to format into- Returns:
- the specified string buffer
-
format
<B extends java.lang.Appendable> B format(long millis, B buf)Formats a millisecond
longvalue into the suppliedAppendable.- Type Parameters:
B- the Appendable class type, usually StringBuilder or StringBuffer.- Parameters:
millis- the millisecond value to formatbuf- the buffer to format into- Returns:
- the specified string buffer
- Since:
- 3.5
-
format
<B extends java.lang.Appendable> B format(java.util.Date date, B buf)Formats a
Dateobject into the suppliedAppendableusing aGregorianCalendar.- Type Parameters:
B- the Appendable class type, usually StringBuilder or StringBuffer.- Parameters:
date- the date to formatbuf- the buffer to format into- Returns:
- the specified string buffer
- Since:
- 3.5
-
format
<B extends java.lang.Appendable> B format(java.util.Calendar calendar, B buf)Formats a
The TimeZone set on the Calendar is only used to adjust the time offset. The TimeZone specified during the construction of the Parser will determine the TimeZone used in the formatted string.Calendarobject into the suppliedAppendable.- Type Parameters:
B- the Appendable class type, usually StringBuilder or StringBuffer.- Parameters:
calendar- the calendar to formatbuf- the buffer to format into- Returns:
- the specified string buffer
- Since:
- 3.5
-
getPattern
java.lang.String getPattern()
Gets the pattern used by this printer.
- Returns:
- the pattern,
SimpleDateFormatcompatible
-
getTimeZone
java.util.TimeZone getTimeZone()
Gets the time zone used by this printer.
This zone is always used for
Dateprinting.- Returns:
- the time zone
-
getLocale
java.util.Locale getLocale()
Gets the locale used by this printer.
- Returns:
- the locale
-
format
java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)Formats a
Date,CalendarorLong(milliseconds) object.- Parameters:
obj- the object to formattoAppendTo- the buffer to append topos- the position - ignored- Returns:
- the buffer passed in
- See Also:
DateFormat.format(Object, StringBuffer, FieldPosition)
-
-