java.lang.Object
org.apache.calcite.util.format.postgresql.format.compiled.CompiledPattern
org.apache.calcite.util.format.postgresql.format.compiled.AmPmCompiledPattern
All Implemented Interfaces:
CompiledItem

public class AmPmCompiledPattern extends CompiledPattern
The date/time format compiled component for AM/PM (first or second half of day).
  • Constructor Details

    • AmPmCompiledPattern

      public AmPmCompiledPattern(Set<PatternModifier> modifiers, boolean upperCase, boolean includePeriods)
  • Method Details

    • convertToString

      public String convertToString(ZonedDateTime dateTime, Locale locale)
      Description copied from interface: CompiledItem
      Creates one portion of the formatted date/time.
      Parameters:
      dateTime - date/time value to format
      locale - Locale to use for day or month names if the TM modifier was present
      Returns:
      the formatted String value of this date/time component
    • parseValue

      public int parseValue(ParsePosition inputPosition, String input, boolean enforceLength, Locale locale) throws ParseException
      Description copied from class: CompiledPattern
      Parse this date/time component from a String.
      Specified by:
      parseValue in class CompiledPattern
      Parameters:
      inputPosition - starting position for parsing
      input - full string that will be parsed
      enforceLength - whether to limit the length of characters read. Needed when one sequence of digits is followed by another (such as YYYYDD).
      locale - Locale to use for parsing day and month names if the TM flag was present
      Returns:
      the integer value of the parsed date/time component
      Throws:
      ParseException - if unable to parse a value from input
    • getBaseFormatPatternLength

      protected int getBaseFormatPatternLength()
      Description copied from class: CompiledPattern
      Returns the length of the format pattern without modifiers.
      Specified by:
      getBaseFormatPatternLength in class CompiledPattern
      Returns:
      length of the format pattern