Class IntDate

java.lang.Object
org.forgerock.json.jose.utils.IntDate

public final class IntDate extends Object
This class provides utility methods for converting Java Date objects into and from IntDates.

Where an IntDate is a JSON numeric value representing the number of seconds from 1970-01-01T0:0:0Z UTC until the specified UTC date/time.

Since:
2.0.0
See Also:
  • Method Details

    • toIntDate

      public static long toIntDate(Date date)
      Converts a Java Date object into an IntDate.

      Note: Precision is lost in this conversion as the milliseconds are dropped as a part of the conversion.

      Parameters:
      date - The Java Date to convert.
      Returns:
      The IntDate representation of the Java Date.
    • fromIntDate

      public static Date fromIntDate(long intDate)
      Converts an IntDate into a Java Date object.

      Note: Milliseconds are set to zero on the converted Java Date as an IntDate does not hold millisecond information.

      Parameters:
      intDate - The IntDate to convert.
      Returns:
      The Java Date representation of the IntDate.