Class CompiledDateTimeFormat
java.lang.Object
org.apache.calcite.util.format.postgresql.CompiledDateTimeFormat
Contains a parsed date/time format. Able to parse a string into a date/time value,
or convert a date/time value to a string.
-
Constructor Summary
ConstructorDescriptionCompiledDateTimeFormat
(com.google.common.collect.ImmutableList<CompiledItem> compiledItems) -
Method Summary
Modifier and TypeMethodDescriptionformatDateTime
(ZonedDateTime dateTime, Locale locale) Converts a date/time value to a string.parseDateTime
(String input, ZoneId zoneId, Locale locale) Parses a date/time value from a string.
-
Constructor Details
-
CompiledDateTimeFormat
-
-
Method Details
-
parseDateTime
public ZonedDateTime parseDateTime(String input, ZoneId zoneId, Locale locale) throws ParseException Parses a date/time value from a string. The format used is in compiledItems.- Parameters:
input
- the String to parsezoneId
- timezone to convert the result tolocale
- Locale to use for parsing day or month names if the TM modifier was present- Returns:
- the parsed date/time value
- Throws:
ParseException
- if the string to parse did not meet the required format
-
formatDateTime
Converts a date/time value to a string. The output format is in compiledItems.- Parameters:
dateTime
- date/time value to convertlocale
- Locale to use for outputting day and month names if the TM modifier was present- Returns:
- the date/time value formatted as a String
-