Class SimpleDate
- java.lang.Object
-
- com.nimbusds.oauth2.sdk.util.date.SimpleDate
-
public class SimpleDate extends Object
Simple date. Supports ISO 8601 formatting and parsing.
-
-
Constructor Summary
Constructors Constructor Description SimpleDate(int year, int month, int day)
Creates a new simple date.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
int
getDay()
Returns the day of the month.int
getMonth()
Returns the month.int
getYear()
Returns the year.int
hashCode()
static SimpleDate
parseISO8601String(String s)
Parses an ISO 8601 representation inYYYY-MM-DD
format.String
toISO8601String()
Returns an ISO 8601 representation inYYYY-MM-DD
format.String
toString()
-
-
-
Constructor Detail
-
SimpleDate
public SimpleDate(int year, int month, int day)
Creates a new simple date. No validation of month and day is performed.- Parameters:
year
- The year.month
- The month.day
- The day of the month.
-
-
Method Detail
-
getYear
public int getYear()
Returns the year.- Returns:
- The year.
-
getMonth
public int getMonth()
Returns the month.- Returns:
- The month.
-
getDay
public int getDay()
Returns the day of the month.- Returns:
- The day of the month.
-
toISO8601String
public String toISO8601String()
Returns an ISO 8601 representation inYYYY-MM-DD
format.Example:
2019-11-01
- Returns:
- The ISO 8601 representation.
-
parseISO8601String
public static SimpleDate parseISO8601String(String s) throws ParseException
Parses an ISO 8601 representation inYYYY-MM-DD
format.Example:
2019-11-01
- Parameters:
s
- The string to parse.- Returns:
- The simple date.
- Throws:
ParseException
- If parsing failed.
-
-