yearOfCentury
yearOfCentury
returns the two-digit year for a date-time.
Syntax
yearOfCentury(instant, timeZone)
yearOfCentury(dateTime)
Parameters
Parameter | Type | Description |
---|---|---|
instant | Instant | The date-time from which to return the year. |
timeZone | ZoneId | The time zone. |
dateTime | ZonedDateTime | The date-time from which to return the year. |
Returns
Returns an int value of the two-digit year for a date-time.
Examples
datetime = parseInstant("2021-07-04T08:00:00 ET")
year = yearOfCentury(datetime, timeZone("ET"))
println year
- Log