Class DateTimeCompatibility
java.lang.Object
io.deephaven.enterprise.compatibility.DateTimeCompatibility
Class to handle compatibility issues with legacy date-time parsing in Deephaven. Functionality is mostly taken from
DBDateTime and DBTimeUtils. Some of this is shadowed but it should be legitimately available in core plus.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines Deephaven-supported timezones, which may be used for PQ-scheduling and display purposes. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull InstantConverts a DateTime String from a few specific zoned formats to anInstantand throws an exception if the format is not recognized.static @Nullable InstantConverts a DateTime String from a few specific zoned formats to anInstant.static InstantDeprecated.static InstantDeprecated.static @NotNull StringtoLegacyString(@NotNull Instant dateTime, @NotNull DateTimeCompatibility.DBTimeZone timeZone) Convert thisInstantinto a String using the providedDateTimeCompatibility.DBTimeZone.
-
Constructor Details
-
DateTimeCompatibility
public DateTimeCompatibility()
-
-
Method Details
-
convertDateTime
Converts a DateTime String from a few specific zoned formats to anInstantand throws an exception if the format is not recognized.- Parameters:
s- string to be converted, usually in the form yyyy-MM-ddThh:mm:ss and with optional sub-seconds after an optional decimal point, followed by a mandatory time zone character code- Returns:
- an
Instantfrom the parsed String - Throws:
IllegalArgumentException- if the string cannot be parsed
-
convertDateTimeQuiet
Converts a DateTime String from a few specific zoned formats to anInstant. Based on DBTimeUtils#convertDateTimeQuiet.- Parameters:
s- string to be converted, usually in the form yyyy-MM-ddThh:mm:ss and with optional sub-seconds after an optional decimal point, followed by a mandatory time zone character code- Returns:
- an
Instantfrom the parsed String, or null if the format is not recognized or an exception occurs
-
convertLegacyDateTimeQuiet
Deprecated.Parse a time string that matchesLEGACY_DATETIME_PATTERN.- Parameters:
s- the string to be parsed- Returns:
- an
Instantfrom the parsed string
-
convertLegacyMicrosDateTimeQuiet
Deprecated.Parse a time string that matchesLEGACY_MICROS_DATETIME_PATTERN.- Parameters:
s- the string to be parsed- Returns:
- an
Instantfrom the parsed string
-
toLegacyString
@NotNull public static @NotNull String toLegacyString(@NotNull @NotNull Instant dateTime, @NotNull @NotNull DateTimeCompatibility.DBTimeZone timeZone) Convert thisInstantinto a String using the providedDateTimeCompatibility.DBTimeZone. Similar to DBDateTime#toString.The date will be formatted as
yyyy-MM-DDThh:mm:ss.SSSSSSSSS TZ, for example2020-05-27T13:37:57.780853000 NYor2020-05-27T17:37:42.763641000 UTC.- Parameters:
dateTime- theInstantto be convertedtimeZone- theDateTimeCompatibility.DBTimeZonefor formatting the string- Returns:
- a String representation of this
DateTimeCompatibility.DBTimeZone
-