Class DateWithTimeZoneOffset
java.lang.Object
com.nimbusds.oauth2.sdk.util.date.DateWithTimeZoneOffset
Date with optional timezone offset. Supports basic ISO 8601 formatting and
parsing.
-
Constructor Summary
ConstructorsConstructorDescriptionDateWithTimeZoneOffset
(Date date) Creates a new date in UTC, to beoutput
withZ
timezone designation.DateWithTimeZoneOffset
(Date date, int tzOffsetMinutes) Creates a new date with timezone offset.DateWithTimeZoneOffset
(Date date, TimeZone tz) Creates a new date with timezone offset. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getDate()
Returns the date.int
Returns the time zone offset in minutes relative to UTC.int
hashCode()
boolean
isUTC()
Returnstrue
if the date is in UTC.static DateWithTimeZoneOffset
Parses an ISO 8601 representation inYYYY-MM-DDThh:mm:ss±hh:mm
format.Returns an ISO 8601 representation inYYYY-MM-DDThh:mm:ssZ
orYYYY-MM-DDThh:mm:ss±hh:mm
formattoString()
-
Constructor Details
-
DateWithTimeZoneOffset
Creates a new date in UTC, to beoutput
withZ
timezone designation.- Parameters:
date
- The date. Must not benull
.
-
DateWithTimeZoneOffset
Creates a new date with timezone offset.- Parameters:
date
- The date. Must not benull
.tzOffsetMinutes
- The time zone offset in minutes relative to UTC, zero if none. Must be less than+/- 12 x 60
.
-
DateWithTimeZoneOffset
Creates a new date with timezone offset.- Parameters:
date
- The date. Must not benull
.tz
- The time zone to determine the time zone offset.
-
-
Method Details
-
getDate
Returns the date.- Returns:
- The date.
-
isUTC
Returnstrue
if the date is in UTC.- Returns:
true
if the date is in UTC, else the time zoneoffset
applies.
-
getTimeZoneOffsetMinutes
Returns the time zone offset in minutes relative to UTC.- Returns:
- The time zone offset in minutes relative to UTC, zero if none.
-
toISO8601String
Returns an ISO 8601 representation inYYYY-MM-DDThh:mm:ssZ
orYYYY-MM-DDThh:mm:ss±hh:mm
formatExample:
2019-11-01T18:19:43+03:00
- Returns:
- The ISO 8601 representation.
-
toString
-
equals
-
hashCode
-
parseISO8601String
Parses an ISO 8601 representation inYYYY-MM-DDThh:mm:ss±hh:mm
format.Example:
2019-11-01T18:19:43+03:00
- Parameters:
s
- The string to parse.- Returns:
- The date with timezone offset.
- Throws:
ParseException
- If parsing failed.
-