Package org.elasticsearch.common.time
Class EpochSecondsDateFormatter
- java.lang.Object
-
- org.elasticsearch.common.time.EpochSecondsDateFormatter
-
- All Implemented Interfaces:
DateFormatter
public class EpochSecondsDateFormatter extends java.lang.Object implements DateFormatter
-
-
Field Summary
Fields Modifier and Type Field Description static DateFormatter
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
format(java.time.temporal.TemporalAccessor accessor)
Print the supplied java time accessor in a string based representation according to this formatterjava.util.Locale
locale()
Returns the configured locale of the date formatterjava.time.temporal.TemporalAccessor
parse(java.lang.String input)
Try to parse input to a java time TemporalAccessorjava.lang.String
pattern()
A name based format for this formatter.DateMathParser
toDateMathParser()
Return aDateMathParser
built from this formatter.DateFormatter
withLocale(java.util.Locale locale)
Create a copy of this formatter that is configured to parse dates in the specified localeDateFormatter
withZone(java.time.ZoneId zoneId)
Create a copy of this formatter that is configured to parse dates in the specified time zonejava.time.ZoneId
zone()
Returns the configured time zone of the date formatter-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.common.time.DateFormatter
formatJoda, formatMillis, parseJoda, parseMillis
-
-
-
-
Field Detail
-
INSTANCE
public static DateFormatter INSTANCE
-
-
Method Detail
-
parse
public java.time.temporal.TemporalAccessor parse(java.lang.String input)
Description copied from interface:DateFormatter
Try to parse input to a java time TemporalAccessor- Specified by:
parse
in interfaceDateFormatter
- Parameters:
input
- An arbitrary string resembling the string representation of a date or time- Returns:
- The java time object containing the parsed input
-
format
public java.lang.String format(java.time.temporal.TemporalAccessor 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 interfaceDateFormatter
- Parameters:
accessor
- The temporal accessor used to format- Returns:
- The string result for the formatting
-
pattern
public java.lang.String pattern()
Description copied from interface:DateFormatter
A name based format for this formatter. Can be one of the registered formatters likeepoch_millis
or a configured format likeHH:mm:ss
- Specified by:
pattern
in interfaceDateFormatter
- Returns:
- The name of this formatter
-
locale
public java.util.Locale locale()
Description copied from interface:DateFormatter
Returns the configured locale of the date formatter- Specified by:
locale
in interfaceDateFormatter
- Returns:
- The locale of this formatter
-
zone
public java.time.ZoneId zone()
Description copied from interface:DateFormatter
Returns the configured time zone of the date formatter- Specified by:
zone
in interfaceDateFormatter
- Returns:
- The time zone of this formatter
-
toDateMathParser
public DateMathParser toDateMathParser()
Description copied from interface:DateFormatter
Return aDateMathParser
built from this formatter.- Specified by:
toDateMathParser
in interfaceDateFormatter
-
withZone
public DateFormatter withZone(java.time.ZoneId 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 interfaceDateFormatter
- Parameters:
zoneId
- The time zone to act on- Returns:
- A copy of the date formatter this has been called on
-
withLocale
public DateFormatter withLocale(java.util.Locale 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 interfaceDateFormatter
- Parameters:
locale
- The local to use for the new formatter- Returns:
- A copy of the date formatter this has been called on
-
-