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 voidformatStorageTimestamp(byte[] buffer, int offset, OffsetDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTimeto Storage Timestamp format.static voidformatTimeOnly(byte[] buffer, LocalTime time, TimestampPrecision precision) Formats the value oflocal timeto theUTCTimeOnlyformat.static voidformatTimeOnly(byte[] buffer, LocalTime time, TimestampPrecision precision, int offset) Formats the value oflocal timeto theUTCTimeOnlyformat.static voidformatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTimetoTimestampformat.static voidformatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision, int offset) Formats the value ofdateTimetoTimestampformat.static voidformatTZTimeOnly(byte[] buffer, OffsetTime time, TimestampPrecision precision) Formats the value ofoffset timeto theTZTimeOnlyformat.static voidformatTZTimeOnly(byte[] buffer, OffsetTime time, TimestampPrecision precision, int offset) Formats the value ofoffset timeto theTZTimeOnlyformat.static voidformatTZTimestamp(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision) Formats the value ofoffset date timeto theTZTimestampformat.static voidformatTZTimestamp(byte[] buffer, OffsetDateTime dateTime, TimestampPrecision precision, int offset) Formats the value ofoffset date timeto theTZTimestampformat.
-
Method Details
-
formatTimeOnly
Formats the value oflocal timeto theUTCTimeOnlyformat.The format for
UTCTimeOnlyis HH:MM:SS[.sss][sss][sss].- Parameters:
buffer- the buffer of bytes to keep theUTCTimeOnlyformattime- 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 timeto theUTCTimeOnlyformat.The format for
UTCTimeOnlyis HH:MM:SS[.sss][sss][sss].- Parameters:
buffer- the buffer of bytes to keep theUTCTimeOnlyformattime- the given time valueprecision- the desired time precisionoffset- the offset- Throws:
IllegalArgumentException
-
formatTZTimeOnly
Formats the value ofoffset timeto theTZTimeOnlyformat.The format for
TZTimeOnlyis HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer- the buffer of bytes to keep theUTCTimeOnlyformattime- 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 timeto theTZTimeOnlyformat.The format for
TZTimeOnlyis HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer- the buffer of bytes to keep theUTCTimeOnlyformattime- the given time valueprecision- the desired time precisionoffset- the offset
-
formatTimestamp
public static void formatTimestamp(byte[] buffer, LocalDateTime dateTime, TimestampPrecision precision) Formats the value ofdateTimetoTimestampformat.The format of
Timestampis YYYYMMDD-HH:MM:SS[.sss][sss][sss].- Parameters:
buffer- the buffer of bytes to keep theTimestampformatdateTime- 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 ofdateTimetoTimestampformat.The format of
Timestampis YYYYMMDD-HH:MM:SS[.sss][sss][sss].- Parameters:
buffer- the buffer of bytes to keep theTimestampformatdateTime- 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 timeto theTZTimestampformat.The format for
TZTimestampis YYYYMMDD-HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer- the buffer of bytes to keep theTZTimestampformatdateTime- 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 timeto theTZTimestampformat.The format for
TZTimestampis YYYYMMDD-HH:MM[:SS][.sss][sss][sss][Z | [ + | - hh[:mm]]].- Parameters:
buffer- the buffer of bytes to keep theTZTimestampformatdateTime- 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 ofdateTimeto 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
-