# Interface DatePrinter

All Known Implementing Classes:
  `FastDateFormat, FastDatePrinter`

public interface DatePrinter
DatePrinter is the "missing" interface for the format methods of `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.

Since:
  3.2

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `format(long millis)`
  Formats a millisecond `long` value.
  `<B extends Appendable>
  B`
  `format(long millis, B buf)`
  Formats a millisecond `long` value into the supplied `Appendable`.
  `StringBuffer`
  `format(long millis, StringBuffer buf)`
  Deprecated.
  Use {`format(long, Appendable)`.
  `StringBuffer`
  `format(Object obj, StringBuffer toAppendTo, FieldPosition pos)`
  Formats a `Date`, `Calendar` or `Long` (milliseconds) object.
  `String`
  `format(Calendar calendar)`
  Formats a `Calendar` object.
  `<B extends Appendable>
  B`
  `format(Calendar calendar, B buf)`
  Formats a `Calendar` object into the supplied `Appendable`.
  `StringBuffer`
  `format(Calendar calendar, StringBuffer buf)`
  Deprecated.
  Use {`format(Calendar, Appendable)`.
  `String`
  `format(Date date)`
  Formats a `Date` object using a `GregorianCalendar`.
  `<B extends Appendable>
  B`
  `format(Date date, B buf)`
  Formats a `Date` object into the supplied `Appendable` using a `GregorianCalendar`.
  `StringBuffer`
  `format(Date date, StringBuffer buf)`
  Deprecated.
  Use {`format(Date, Appendable)`.
  `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.

- ## Method Details

  - ### format

    String format(Calendar calendar)
    Formats a `Calendar` object. 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.
    Parameters:
      `calendar` - the calendar to format.
    Returns:
      the formatted string.

  - ### format

    <B extends Appendable> B format(Calendar calendar, B buf)
    Formats a `Calendar` object into the supplied `Appendable`. 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.
    Type Parameters:
      `B` - the Appendable class type, usually StringBuilder or StringBuffer.
    Parameters:
      `calendar` - the calendar to format.
      `buf` - the buffer to format into.
    Returns:
      the specified string buffer.
    Since:
      3.5

  - ### format

    @Deprecated StringBuffer format(Calendar calendar, StringBuffer buf)
    Deprecated.
    Use {`format(Calendar, Appendable)`.
    Formats a `Calendar` object into the supplied `StringBuffer`. 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.
    Parameters:
      `calendar` - the calendar to format.
      `buf` - the buffer to format into.
    Returns:
      the specified string buffer.

  - ### format

    String format(Date date)
    Formats a `Date` object using a `GregorianCalendar`.
    Parameters:
      `date` - the date to format
    Returns:
      the formatted string

  - ### format

    <B extends Appendable> B format(Date date, B buf)
    Formats a `Date` object into the supplied `Appendable` using a `GregorianCalendar`.
    Type Parameters:
      `B` - the Appendable class type, usually StringBuilder or StringBuffer.
    Parameters:
      `date` - the date to format.
      `buf` - the buffer to format into.
    Returns:
      the specified string buffer.
    Since:
      3.5

  - ### format

    @Deprecated StringBuffer format(Date date, StringBuffer buf)
    Deprecated.
    Use {`format(Date, Appendable)`.
    Formats a `Date` object into the supplied `StringBuffer` using a `GregorianCalendar`.
    Parameters:
      `date` - the date to format.
      `buf` - the buffer to format into.
    Returns:
      the specified string buffer.

  - ### format

    String format(long millis)
    Formats a millisecond `long` value.
    Parameters:
      `millis` - the millisecond value to format.
    Returns:
      the formatted string.
    Since:
      2.1

  - ### format

    <B extends Appendable> B format(long millis, B buf)
    Formats a millisecond `long` value into the supplied `Appendable`.
    Type Parameters:
      `B` - the Appendable class type, usually StringBuilder or StringBuffer.
    Parameters:
      `millis` - the millisecond value to format.
      `buf` - the buffer to format into.
    Returns:
      the specified string buffer.
    Since:
      3.5

  - ### format

    @Deprecated StringBuffer format(long millis, StringBuffer buf)
    Deprecated.
    Use {`format(long, Appendable)`.
    Formats a millisecond `long` value into the supplied `StringBuffer`.
    Parameters:
      `millis` - the millisecond value to format.
      `buf` - the buffer to format into.
    Returns:
      the specified string buffer.

  - ### format

    StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos)
    Formats a `Date`, `Calendar` or `Long` (milliseconds) object.
    Parameters:
      `obj` - the object to format.
      `toAppendTo` - the buffer to append to.
      `pos` - the position - ignored.
    Returns:
      the buffer passed in.
    See Also:
      - `DateFormat.format(Object, StringBuffer, FieldPosition)`

  - ### getLocale

    Locale getLocale()
    Gets the locale used by this printer.
    Returns:
      the locale.

  - ### getPattern

    String getPattern()
    Gets the pattern used by this printer.
    Returns:
      the pattern, `SimpleDateFormat` compatible.

  - ### getTimeZone

    TimeZone getTimeZone()
    Gets the time zone used by this printer.

    This zone is always used for `Date` printing.

    Returns:
      the time zone.