org.apache.commons.lang3.time

## Interface DatePrinter

- All Known Implementing Classes:
    FastDateFormat, FastDatePrinter

      public interface DatePrinter

  DatePrinter is the "missing" interface for the format methods of `DateFormat`.

  Since:
    3.2

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `format(Calendar calendar)` Formats a `Calendar` object.
    `StringBuffer` | `format(Calendar calendar, StringBuffer buf)` Formats a `Calendar` object into the supplied `StringBuffer`.
    `String` | `format(Date date)` Formats a `Date` object using a `GregorianCalendar`.
    `StringBuffer` | `format(Date date, StringBuffer buf)` Formats a `Date` object into the supplied `StringBuffer` using a `GregorianCalendar`.
    `String` | `format(long millis)` Formats a millisecond `long` value.
    `StringBuffer` | `format(long millis, StringBuffer buf)` Formats a milliseond `long` value into the supplied `StringBuffer`.
    `StringBuffer` | `format(Object obj, StringBuffer 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.

- - ### Method Detail

    - #### 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

          String format(Date date)

      Formats a `Date` object using a `GregorianCalendar`.

      Parameters:
        `date` - the date to format
      Returns:
        the formatted string

    - #### format

          String format(Calendar calendar)

      Formats a `Calendar` object.

      Parameters:
        `calendar` - the calendar to format
      Returns:
        the formatted string

    - #### format

          StringBuffer format(long millis,
                            StringBuffer buf)

      Formats a milliseond `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(Date date,
                            StringBuffer buf)

      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

          StringBuffer format(Calendar calendar,
                            StringBuffer buf)

      Formats a `Calendar` object into the supplied `StringBuffer`.

      Parameters:
        `calendar` - the calendar to format
        `buf` - the buffer to format into
      Returns:
        the specified string buffer

    - #### 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

    - #### getLocale

          Locale getLocale()

      Gets the locale used by this printer.

      Returns:
        the locale

    - #### format

          StringBuffer format(Object obj,
                            StringBuffer toAppendTo,
                            FieldPosition pos)

      Formats a `Date`, `Calendar` or `Long` (milliseconds) object.

      See `DateFormat.format(Object, StringBuffer, FieldPosition)`
      Parameters:
        `obj` - the object to format
        `toAppendTo` - the buffer to append to
        `pos` - the position - ignored
      Returns:
        the buffer passed in

Copyright © 2001–2013 The Apache Software Foundation. All rights reserved.