Class JodaDateFormatter

org.elasticsearch.common.joda.JodaDateFormatter
All Implemented Interfaces:
DateFormatter

public class JodaDateFormatter extends implements DateFormatter
  • Method Summary

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

    Methods inherited from class java.lang.

    , , , , , , , ,
  • Method Details

    • parse

      public  parse( input)
      Description copied from interface: DateFormatter
      Try to parse input to a java time TemporalAccessor
      Specified by:
      parse in interface DateFormatter
      Parameters:
      input - An arbitrary string resembling the string representation of a date or time
      Returns:
      The java time object containing the parsed input
    • parseMillis

      public long parseMillis( input)
      Description copied from interface: DateFormatter
      Parse the given input into millis-since-epoch.
      Specified by:
      parseMillis in interface DateFormatter
    • parseJoda

      public org.joda.time.DateTime parseJoda( input)
      Description copied from interface: DateFormatter
      Parse the given input into a Joda DateTime.
      Specified by:
      parseJoda in interface DateFormatter
    • withZone

      public  zoneId)
      Description copied from interface: DateFormatter
      Create a copy of this formatter that is configured to parse dates in the specified time zone
      Specified by:
      withZone in interface DateFormatter
      Parameters:
      zoneId - The time zone to act on
      Returns:
      A copy of the date formatter this has been called on
    • withLocale

      public  locale)
      Description copied from interface: DateFormatter
      Create a copy of this formatter that is configured to parse dates in the specified locale
      Specified by:
      withLocale in interface DateFormatter
      Parameters:
      locale - The local to use for the new formatter
      Returns:
      A copy of the date formatter this has been called on
    • format

      public  format( accessor)
      Description copied from interface: DateFormatter
      Print the supplied java time accessor in a string based representation according to this formatter
      Specified by:
      format in interface DateFormatter
      Parameters:
      accessor - The temporal accessor used to format
      Returns:
      The string result for the formatting
    • formatJoda

      public  formatJoda(org.joda.time.DateTime dateTime)
      Description copied from interface: DateFormatter
      Return the given Joda DateTime formatted with this format.
      Specified by:
      formatJoda in interface DateFormatter
    • formatMillis

      public  formatMillis(long millis)
      Description copied from interface: DateFormatter
      Return the given millis-since-epoch formatted with this format.
      Specified by:
      formatMillis in interface DateFormatter
    • withYear

      public JodaDateFormatter withYear(int year)
    • pattern

      public  pattern()
      Description copied from interface: DateFormatter
      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
      Specified by:
      pattern in interface DateFormatter
      Returns:
      The name of this formatter
    • locale

      public  locale()
      Description copied from interface: DateFormatter
      Returns the configured locale of the date formatter
      Specified by:
      locale in interface DateFormatter
      Returns:
      The locale of this formatter
    • zone

      public  zone()
      Description copied from interface: DateFormatter
      Returns the configured time zone of the date formatter
      Specified by:
      zone in interface DateFormatter
      Returns:
      The time zone of this formatter
    • toDateMathParser

      public DateMathParser toDateMathParser()
      Description copied from interface: DateFormatter
      Create a DateMathParser from the existing formatter
      Specified by:
      toDateMathParser in interface DateFormatter
      Returns:
      The DateMathParser object
    • hashCode

      public int hashCode()
      Overrides:
       in class 
    • equals

      public boolean equals( obj)
      Overrides:
       in class