Interface TimestampConverter

All Known Implementing Classes:
DateTimeFormatterTimestampConverter

public interface TimestampConverter
A converter that enables conversions of textual timestamps to epoch seconds or milliseconds according to a given pattern.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    toEpochMillis(String timestamp)
    Converts the a textual timestamp into an epoch in milliseconds
    long
    Converts the a textual timestamp into an epoch in seconds
  • Method Details

    • toEpochSeconds

      long toEpochSeconds(String timestamp)
      Converts the a textual timestamp into an epoch in seconds
      Parameters:
      timestamp - the timestamp to convert, not null. The timestamp is expected to be formatted according to the pattern of the formatter. In addition, the pattern is assumed to contain both date and time information.
      Returns:
      the epoch in seconds for the given timestamp
      Throws:
      DateTimeParseException - if unable to parse the given timestamp
    • toEpochMillis

      long toEpochMillis(String timestamp)
      Converts the a textual timestamp into an epoch in milliseconds
      Parameters:
      timestamp - the timestamp to convert, not null. The timestamp is expected to be formatted according to the pattern of the formatter. In addition, the pattern is assumed to contain both date and time information.
      Returns:
      the epoch in milliseconds for the given timestamp
      Throws:
      DateTimeParseException - if unable to parse the given timestamp