Class DateTimeFormatter

java.lang.Object
io.deephaven.time.DateTimeFormatter

public class DateTimeFormatter extends Object
String formatter for Instant and ZonedDateTime.
  • Constructor Details

    • DateTimeFormatter

      public DateTimeFormatter(String pattern)
      Creates a new date time formatter using the default time zone. See DateTimeFormatter for valid format strings.
      Parameters:
      pattern - format pattern.
      See Also:
    • DateTimeFormatter

      public DateTimeFormatter(boolean isISO, boolean hasDate, boolean hasTime, int subsecondDigits, boolean hasTZ)
      Creates a new date time formatter.
      Parameters:
      isISO - ISO 8601 format
      hasDate - include date
      hasTime - include time
      subsecondDigits - include subsecond digits
      hasTZ - include time zone
  • Method Details

    • format

      @NotNull public @NotNull String format(@NotNull @NotNull ZonedDateTime dateTime)
      Returns a ZonedDateTime formatted as a string.
      Parameters:
      dateTime - date time to format as a string.
      Returns:
      date time formatted as a string.
    • format

      @NotNull public @NotNull String format(@NotNull @NotNull Instant instant, @NotNull @NotNull ZoneId timeZone)
      Returns an Instant formatted as a string.
      Parameters:
      instant - time to format as a string.
      timeZone - time zone to use when formatting the string.
      Returns:
      date time formatted as a string.
    • format

      @NotNull public @NotNull String format(@NotNull @NotNull Instant instant)
      Returns an Instant formatted as a string using the default time zone.
      Parameters:
      instant - time to format as a string.
      Returns:
      date time formatted as a string.
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getPattern

      public String getPattern()
      Gets the format pattern.
      Returns:
      format pattern.