Package io.deephaven.time
Class DateTimeFormatter
java.lang.Object
io.deephaven.time.DateTimeFormatter
String formatter for
Instant
and ZonedDateTime
.-
Constructor Summary
ConstructorDescriptionDateTimeFormatter
(boolean isISO, boolean hasDate, boolean hasTime, int subsecondDigits, boolean hasTZ) Creates a new date time formatter.DateTimeFormatter
(String pattern) Creates a new date time formatter using the default time zone. -
Method Summary
Modifier and TypeMethodDescription@NotNull String
Returns an Instant formatted as a string using the default time zone.@NotNull String
Returns an Instant formatted as a string.@NotNull String
format
(@NotNull ZonedDateTime dateTime) Returns a ZonedDateTime formatted as a string.Gets the format pattern.toString()
-
Constructor Details
-
DateTimeFormatter
Creates a new date time formatter using the default time zone. SeeDateTimeFormatter
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 formathasDate
- include datehasTime
- include timesubsecondDigits
- include subsecond digitshasTZ
- include time zone
-
-
Method Details
-
format
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
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
-
getPattern
Gets the format pattern.- Returns:
- format pattern.
-