public final class GeneralizedTime extends Object implements Comparable<GeneralizedTime>
Modifier and Type | Field and Description |
---|---|
static GeneralizedTime |
MIN_GENERALIZED_TIME
The smallest time representable using the generalized time syntax.
|
static long |
MIN_GENERALIZED_TIME_MS
The smallest time in milli-seconds representable using the generalized time syntax.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(GeneralizedTime o) |
static GeneralizedTime |
currentTime()
Returns a generalized time whose value is the current time, using the
default time zone and locale.
|
boolean |
equals(Object obj) |
long |
getTimeInMillis()
Returns the value of this generalized time in milliseconds since the
epoch.
|
int |
hashCode() |
Calendar |
toCalendar()
Returns a
Calendar representation of this generalized time. |
Date |
toDate()
Returns a
Date representation of this generalized time. |
OffsetDateTime |
toOffsetDateTime()
Returns a
OffsetDateTime representation of this generalized time. |
String |
toString() |
static GeneralizedTime |
valueOf(Calendar calendar)
Returns a generalized time representing the provided
Calendar . |
static GeneralizedTime |
valueOf(Date date)
Returns a generalized time representing the provided
Date . |
static GeneralizedTime |
valueOf(long timeMS)
Returns a generalized time representing the provided time in milliseconds
since the epoch.
|
static GeneralizedTime |
valueOf(OffsetDateTime offsetDateTime)
Returns a generalized time representing the provided
OffsetDateTime . |
static GeneralizedTime |
valueOf(String time)
Parses the provided string as an LDAP generalized time.
|
public static final GeneralizedTime MIN_GENERALIZED_TIME
public static final long MIN_GENERALIZED_TIME_MS
public static GeneralizedTime currentTime()
public static GeneralizedTime valueOf(Calendar calendar)
Calendar
.
The provided calendar will be defensively copied in order to preserve immutability.
calendar
- The calendar to be converted to a generalized time.Calendar
.public static GeneralizedTime valueOf(Date date)
Date
.
The provided date will be defensively copied in order to preserve immutability.
date
- The date to be converted to a generalized time.Date
.public static GeneralizedTime valueOf(long timeMS)
timeMS
- The time to be converted to a generalized time.public static GeneralizedTime valueOf(String time)
time
- The generalized time value to be parsed.LocalizedIllegalArgumentException
- If time
cannot be parsed as a valid generalized time
string.NullPointerException
- If time
was null
.public static GeneralizedTime valueOf(OffsetDateTime offsetDateTime)
OffsetDateTime
.offsetDateTime
- The OffsetDateTime
to be converted to a generalized time.OffsetDateTime
.toOffsetDateTime()
public int compareTo(GeneralizedTime o)
compareTo
in interface Comparable<GeneralizedTime>
public long getTimeInMillis()
public Calendar toCalendar()
Calendar
representation of this generalized time.
Subsequent modifications to the returned calendar will not alter the internal state of this generalized time.
Calendar
representation of this generalized time.public Date toDate()
Date
representation of this generalized time.
Subsequent modifications to the returned date will not alter the internal state of this generalized time.
Date
representation of this generalized time.public OffsetDateTime toOffsetDateTime()
OffsetDateTime
representation of this generalized time.OffsetDateTime
representation of this generalized time.valueOf(OffsetDateTime)
Copyright 2010-2022 ForgeRock AS.