Interface DateFormatter

All Known Implementing Classes:
JodaDateFormatter

public interface DateFormatter
  • Method Summary

    Modifier and Type
    Method
    Description
     accessor)
    Print the supplied java time accessor in a string based representation according to this formatter
    default
    formatJoda​(org.joda.time.DateTime dateTime)
    Return the given Joda DateTime formatted with this format.
    default
    formatMillis​(long millis)
    Return the given millis-since-epoch formatted with this format.
     input)
     
    Returns the configured locale of the date formatter
     input)
    Try to parse input to a java time TemporalAccessor
    default org.joda.time.DateTime
     input)
    Parse the given input into a Joda DateTime.
    default long
     input)
    Parse the given input into millis-since-epoch.
    A name based format for this formatter.
    static <>
     input)
     
    static
     input)
     
    Create a DateMathParser from the existing formatter
     locale)
    Create a copy of this formatter that is configured to parse dates in the specified locale
     zoneId)
    Create a copy of this formatter that is configured to parse dates in the specified time zone
    Returns the configured time zone of the date formatter
  • Method Details

    • parse

       parse( input)
      Try to parse input to a java time TemporalAccessor
      Parameters:
      input - An arbitrary string resembling the string representation of a date or time
      Returns:
      The java time object containing the parsed input
      Throws:
      - If parsing fails, this exception will be thrown. Note that it can contained suppressed exceptions when several formatters failed parse this value
    • parseMillis

      default long parseMillis( input)
      Parse the given input into millis-since-epoch.
    • parseJoda

      default org.joda.time.DateTime parseJoda( input)
      Parse the given input into a Joda DateTime.
    • withZone

       zoneId)
      Create a copy of this formatter that is configured to parse dates in the specified time zone
      Parameters:
      zoneId - The time zone to act on
      Returns:
      A copy of the date formatter this has been called on
    • withLocale

       locale)
      Create a copy of this formatter that is configured to parse dates in the specified locale
      Parameters:
      locale - The local to use for the new formatter
      Returns:
      A copy of the date formatter this has been called on
    • format

       format( accessor)
      Print the supplied java time accessor in a string based representation according to this formatter
      Parameters:
      accessor - The temporal accessor used to format
      Returns:
      The string result for the formatting
    • formatMillis

      default  formatMillis(long millis)
      Return the given millis-since-epoch formatted with this format.
    • formatJoda

      default  formatJoda(org.joda.time.DateTime dateTime)
      Return the given Joda DateTime formatted with this format.
    • pattern

       pattern()
      A name based format for this formatter. Can be one of the registered formatters like epoch_millis or a configured format like HH:mm:ss
      Returns:
      The name of this formatter
    • locale

       locale()
      Returns the configured locale of the date formatter
      Returns:
      The locale of this formatter
    • zone

       zone()
      Returns the configured time zone of the date formatter
      Returns:
      The time zone of this formatter
    • toDateMathParser

      DateMathParser toDateMathParser()
      Create a DateMathParser from the existing formatter
      Returns:
      The DateMathParser object
    • forPattern

      static  input)
    • strip8Prefix

      static  strip8Prefix( input)
    • splitCombinedPatterns

      static <> splitCombinedPatterns( input)