public interface DatePrinter
DateFormat
. 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.
Copied and modified from Apache Commons Lang.
Modifier and Type | Method and Description |
---|---|
String |
format(Calendar calendar)
Formats a
Calendar object. |
<B extends Appendable> |
format(Calendar calendar,
B buf)
Formats a
Calendar object into the supplied Appendable . |
String |
format(Date date)
Formats a
Date object using a GregorianCalendar . |
<B extends Appendable> |
format(Date date,
B buf)
Formats a
Date object into the
supplied Appendable using a GregorianCalendar . |
String |
format(long millis)
Formats a millisecond
long value. |
<B extends Appendable> |
format(long millis,
B buf)
Formats a millisecond
long value into the
supplied Appendable . |
StringBuilder |
format(Object obj,
StringBuilder toAppendTo,
FieldPosition pos)
Formats a
Date , Calendar or
Long (milliseconds) object. |
Locale |
getLocale()
Gets the locale used by this printer.
|
String |
getPattern()
Gets the pattern used by this printer.
|
TimeZone |
getTimeZone()
Gets the time zone used by this printer.
|
String format(long millis)
Formats a millisecond long
value.
millis
- the millisecond value to formatString format(Date date)
Formats a Date
object using a GregorianCalendar
.
date
- the date to formatString format(Calendar calendar)
Formats a Calendar
object.
calendar
- the calendar to format.<B extends Appendable> B format(long millis, B buf)
Formats a millisecond long
value into the
supplied Appendable
.
B
- the Appendable class type, usually StringBuilder or StringBuffer.millis
- the millisecond value to formatbuf
- the buffer to format into<B extends Appendable> B format(Date date, B buf)
Formats a Date
object into the
supplied Appendable
using a GregorianCalendar
.
B
- the Appendable class type, usually StringBuilder or StringBuffer.date
- the date to formatbuf
- the buffer to format into<B extends Appendable> B format(Calendar calendar, B buf)
Formats a Calendar
object into the supplied Appendable
.
B
- the Appendable class type, usually StringBuilder or StringBuffer.calendar
- the calendar to formatbuf
- the buffer to format intoString getPattern()
Gets the pattern used by this printer.
SimpleDateFormat
compatibleTimeZone getTimeZone()
Gets the time zone used by this printer.
This zone is always used for Date
printing.
Locale getLocale()
Gets the locale used by this printer.
StringBuilder format(Object obj, StringBuilder toAppendTo, FieldPosition pos)
Formats a Date
, Calendar
or
Long
(milliseconds) object.
obj
- the object to formattoAppendTo
- the buffer to append topos
- the position - ignoredDateFormat.format(Object, StringBuffer, FieldPosition)
Copyright © 1999-2023 The Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.