Interface Timestamp


public interface Timestamp
A point in time independent of any time zone or calendar, represented as milliseconds in UTC UNIX Epoch time.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Timestamp
    The Timestamp from the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z set to none.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Timestamp
    fromMicros(long microseconds)
    Creates a Timestamp from the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
    static Timestamp
    fromMillis(long milliseconds)
    Creates a Timestamp from the number of milliseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
    static Timestamp
    fromSeconds(long seconds)
    Creates a Timestamp from the number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
    default long
    Returns the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
    default long
    Returns the number of milliseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
    default long
    Returns the number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
  • Field Details

    • NONE

      static final Timestamp NONE
      The Timestamp from the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z set to none.
  • Method Details

    • fromSeconds

      static Timestamp fromSeconds(long seconds)
      Creates a Timestamp from the number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
      Parameters:
      seconds - the number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z
      Returns:
      a Timestamp from the number of seconds of UTC time since Unix epoch
      Throws:
      IllegalArgumentException - when the seconds argument is negative
    • fromMillis

      static Timestamp fromMillis(long milliseconds)
      Creates a Timestamp from the number of milliseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
      Parameters:
      milliseconds - the number of milliseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z
      Returns:
      a Timestamp from the number of milliseconds of UTC time since Unix epoch
      Throws:
      IllegalArgumentException - when the milliseconds argument is negative
    • fromMicros

      static Timestamp fromMicros(long microseconds)
      Creates a Timestamp from the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
      Parameters:
      microseconds - the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z
      Returns:
      a Timestamp from the number of microseconds of UTC time since Unix epoch
      Throws:
      IllegalArgumentException - when the microseconds argument is negative
    • toMicros

      default long toMicros()
      Returns the number of microseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
      Returns:
      the number of microseconds of UTC time since Unix epoch
    • toMillis

      default long toMillis()
      Returns the number of milliseconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
      Returns:
      the number of milliseconds of UTC time since Unix epoch
    • toSeconds

      default long toSeconds()
      Returns the number of seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.
      Returns:
      the number of seconds of UTC time since Unix epoch