Class HighPrecisionDateTimeFormatters
Provides ability for formatting different types of date/time values to the buffer of bytes. It is also possible to work with high precision values: micro- and nanoseconds.
- Author:
- Liubov_Efremova
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
formatStorageTimestamp
(byte[] buffer, int offset, OffsetDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTime
to Storage Timestamp format.static void
formatTimeOnly
(byte[] buffer, LocalTime time, TimestampPrecision precision) Formats the value oflocal time
to theUTCTimeOnly
format.static void
formatTimeOnly
(byte[] buffer, LocalTime time, TimestampPrecision precision, int offset) Formats the value oflocal time
to theUTCTimeOnly
format.static void
formatTimestamp
(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTime
toTimestamp
format.static void
formatTimestamp
(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision, int offset) Formats the value ofdateTime
toTimestamp
format.static void
formatTZTimeOnly
(byte[] buffer, OffsetTime time, TimestampPrecision precision) Formats the value ofoffset time
to theTZTimeOnly
format.static void
formatTZTimeOnly
(byte[] buffer, OffsetTime time, TimestampPrecision precision, int offset) Formats the value ofoffset time
to theTZTimeOnly
format.static void
formatTZTimestamp
(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision) Formats the value ofoffset date time
to theTZTimestamp
format.static void
formatTZTimestamp
(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision, int offset) Formats the value ofoffset date time
to theTZTimestamp
format.
-
Method Details
-
formatTimeOnly
Formats the value oflocal time
to theUTCTimeOnly
format.The format for
UTCTimeOnly
is HH:MM:SS[.sss][sss][sss].- Parameters:
buffer
- the buffer of bytes to keep theUTCTimeOnly
formattime
- the given time valueprecision
- the desired time precision- Throws:
IllegalArgumentException
-
formatTimeOnly
public static void formatTimeOnly(byte[] buffer, LocalTime time, TimestampPrecision precision, int offset) Formats the value oflocal time
to theUTCTimeOnly
format.The format for
UTCTimeOnly
is HH:MM:SS[.sss][sss][sss].- Parameters:
buffer
- the buffer of bytes to keep theUTCTimeOnly
formattime
- the given time valueprecision
- the desired time precisionoffset
- the offset- Throws:
IllegalArgumentException
-
formatTZTimeOnly
Formats the value ofoffset time
to theTZTimeOnly
format.The format for
TZTimeOnly
is HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer
- the buffer of bytes to keep theUTCTimeOnly
formattime
- the given time valueprecision
- the desired time precision
-
formatTZTimeOnly
public static void formatTZTimeOnly(byte[] buffer, OffsetTime time, TimestampPrecision precision, int offset) Formats the value ofoffset time
to theTZTimeOnly
format.The format for
TZTimeOnly
is HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer
- the buffer of bytes to keep theUTCTimeOnly
formattime
- the given time valueprecision
- the desired time precisionoffset
- the offset
-
formatTimestamp
public static void formatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTime
toTimestamp
format.The format of
Timestamp
is YYYYMMDD-HH:MM:SS[.sss][sss][sss].- Parameters:
buffer
- the buffer of bytes to keep theTimestamp
formatdateTime
- the given date time valueprecision
- the desired timestamp precision- Throws:
IllegalArgumentException
-
formatTimestamp
public static void formatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision, int offset) Formats the value ofdateTime
toTimestamp
format.The format of
Timestamp
is YYYYMMDD-HH:MM:SS[.sss][sss][sss].- Parameters:
buffer
- the buffer of bytes to keep theTimestamp
formatdateTime
- the given date time valueprecision
- the desired timestamp precisionoffset
- the offset- Throws:
IllegalArgumentException
-
formatTZTimestamp
public static void formatTZTimestamp(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision) Formats the value ofoffset date time
to theTZTimestamp
format.The format for
TZTimestamp
is YYYYMMDD-HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer
- the buffer of bytes to keep theTZTimestamp
formatdateTime
- the given date time valueprecision
- the desired timestamp precision
-
formatTZTimestamp
public static void formatTZTimestamp(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision, int offset) Formats the value ofoffset date time
to theTZTimestamp
format.The format for
TZTimestamp
is YYYYMMDD-HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer
- the buffer of bytes to keep theTZTimestamp
formatdateTime
- the given date time valueprecision
- the desired timestamp precisionoffset
- the offset
-
formatStorageTimestamp
public static void formatStorageTimestamp(byte[] buffer, int offset, OffsetDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTime
to Storage Timestamp format.The format of Storage Timestamp is "YYYYMMDD HH:MM:SS.sss[sss][sss] - ".
- Parameters:
buffer
- the buffer of bytes to keep the Storage Timestamp formatoffset
- the offsetdateTime
- the given date time valueprecision
- the desired timestamp precision- Throws:
IllegalArgumentException
-