Interface FormatPrinter

All Superinterfaces:
DatePrinter
All Known Implementing Classes:
FastDatePrinter, FormatBuilder

public interface FormatPrinter extends DatePrinter
日期格式化输出接口
Since:
Java 17+
Author:
Kimi Liu
  • Method Summary

    Modifier and Type
    Method
    Description
    format(long millis)
    格式化日期表示的毫秒数
    <B extends Appendable>
    B
    format(long millis, B buf)
    Formats a millisecond long value into the supplied Appendable.
    format(Calendar calendar)
    Formats a Calendar object.
    <B extends Appendable>
    B
    format(Calendar calendar, B buf)
    Formats a Calendar object into the supplied Appendable.
    format(Date date)
    使用 GregorianCalendar 格式化 Date
    <B extends Appendable>
    B
    format(Date date, B buf)
    Formats a Date object into the supplied Appendable using a GregorianCalendar.

    Methods inherited from interface org.miaixz.bus.core.center.date.printer.DatePrinter

    getLocale, getPattern, getTimeZone
  • Method Details

    • format

      String format(long millis)
      格式化日期表示的毫秒数
      Parameters:
      millis - 日期毫秒数
      Returns:
      the formatted string
    • format

      String format(Date date)
      使用 GregorianCalendar 格式化 Date
      Parameters:
      date - 日期 Date
      Returns:
      格式化后的字符串
    • format

      String format(Calendar calendar)
      Formats a Calendar object.

      格式化 Calendar

      Parameters:
      calendar - Calendar
      Returns:
      格式化后的字符串
    • 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
    • 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
    • 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