hourOfDay

hourOfDay returns an int representing the hour of the input date-time. Hours are from 0-23, with times between midnight and 1AM on a given day returning the hour 0.

Note

On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.

Syntax

Parameters

ParameterTypeDescription
instantInstant

The time for which to find the hour of the day.

timeZoneZoneId

The time zone to use when interpreting the date-time.

dateTimeZonedDateTime

The zoned date-time for which to find the hour of the day.

asLocalTimeboolean

Set this parameter to false if you need Deephaven to account for daylight savings time.

  • If false, returns the number of hours from the start of the day. However, on days when daylight savings time events occur, results may be different from what is expected based on the local time. For example, on DST change days, 9:30 AM may be earlier or later in the day based on whether the daylight savings time adjustment is forward or backward.
  • If true, returns the number of hours from the start of the day according to the local time. In this case, 9:30 will always return the same value.

On non-DST days, the result is the same regardless of the value of asLocalTime.

localDateTimeLocalDateTime

The local date-time for which to find the hour of the day.

localTimeLocalTime

The local time for which to find the hour of the day.

Returns

Returns a 0-based int value of the hour of the day.

Examples