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 beoutputwithZtimezone 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 TypeMethodDescriptionbooleangetDate()Returns the date.intReturns the time zone offset in minutes relative to UTC.inthashCode()booleanisUTC()Returnstrueif the date is in UTC.static DateWithTimeZoneOffsetParses an ISO 8601 representation inYYYY-MM-DDThh:mm:ss±hh:mmformat.Returns an ISO 8601 representation inYYYY-MM-DDThh:mm:ssZorYYYY-MM-DDThh:mm:ss±hh:mmformattoString()
-
Constructor Details
-
DateWithTimeZoneOffset
Creates a new date in UTC, to beoutputwithZtimezone 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
Returnstrueif the date is in UTC.- Returns:
trueif the date is in UTC, else the time zoneoffsetapplies.
-
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:ssZorYYYY-MM-DDThh:mm:ss±hh:mmformatExample:
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:mmformat.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.
-