dayOfYear
dayOfYear
returns the integer value of the day of the year for an input date-time in the specified time zone.
Syntax
dayOfYear(instant, timeZone)
dayOfYear(dateTime)
Parameters
Parameter | Type | Description |
---|---|---|
instant | Instant | The instant for which to find the day of the month. |
timeZone | TimeZone | The time zone to use when interpreting the date-time. |
dateTime | ZonedDateTime | The zoned date-time for which to find the day of the year. |
Returns
Returns a 1-based int value of the day of the year.
Examples
datetime = parseInstant("2024-02-29T01:23:45 ET")
datetime_zoned = toZonedDateTime(datetime, timeZone("MT"))
day = dayOfYear(datetime, timeZone("ET"))
day_zoned = dayOfYear(datetime_zoned)
println day
println day_zoned
- Log