Package dev.vortex

Class DateTimeUtil

java.lang.Object
dev.vortex.DateTimeUtil

public final class DateTimeUtil extends Object
Utility class for date and time conversions in Vortex.

This class provides helper functions for converting Java date/time objects to nanoseconds since the Unix epoch, which is the internal representation used by Vortex for temporal data.

Helpful functions borrowed from Iceberg class with same name.

  • Field Details

    • EPOCH

      public static final OffsetDateTime EPOCH
      The Unix epoch as an OffsetDateTime (1970-01-01T00:00:00Z).
  • Constructor Details

    • DateTimeUtil

      public DateTimeUtil()
  • Method Details

    • nanosFromTimestamp

      public static long nanosFromTimestamp(LocalDateTime dateTime)
      Converts a LocalDateTime to nanoseconds since the Unix epoch.

      The LocalDateTime is assumed to be in UTC timezone for conversion purposes. When decoded back to LocalDateTime, the timezone information will not be preserved.

      Parameters:
      dateTime - the LocalDateTime to convert
      Returns:
      nanoseconds since the Unix epoch
    • nanosFromTimestamptz

      public static long nanosFromTimestamptz(OffsetDateTime dateTime)
      Converts an OffsetDateTime to nanoseconds since the Unix epoch.

      The timezone information in the OffsetDateTime is preserved during conversion.

      Parameters:
      dateTime - the OffsetDateTime to convert
      Returns:
      nanoseconds since the Unix epoch