Class TimestampUtil


  • public final class TimestampUtil
    extends Object
    Excel timestamp utility methods. For more information, check this out.
    • Constructor Detail

      • TimestampUtil

        public TimestampUtil()
    • Method Detail

      • convertDate

        public static Double convertDate​(Date date)
        Convert a Date to a serial number. Note Excel timestamps do not carry any timezone information; this method uses the system timezone to convert the timestamp to a serial number. If you need a specific timezone, prefer using convertZonedDateTime(java.time.ZonedDateTime).
        Parameters:
        date - Date value.
        Returns:
        Serial number value.
      • convertDate

        public static Double convertDate​(LocalDateTime localDateTime)
        Convert a LocalDateTime to a serial number.
        Parameters:
        localDateTime - Local date time value.
        Returns:
        Serial number value.
      • convertDate

        public static Double convertDate​(LocalDate localDate)
        Convert a LocalDate to a serial number.
        Parameters:
        localDate - Local date value.
        Returns:
        Serial number value.
      • convertZonedDateTime

        public static Double convertZonedDateTime​(ZonedDateTime zonedDateTime)
        Convert a ZonedDateTime to a serial number.
        Parameters:
        zonedDateTime - Date and timezone values.
        Returns:
        Serial number value.
      • convertInstant

        public static Double convertInstant​(Instant instant)
        Convert an Instant to a serial number. This method does care about timestamp information, all conversions are done in UTC.
        Parameters:
        instant - Instant value.
        Returns:
        Serial number value.