Skip to main content

hour

Returns a number representing the hour part of a datetime object.

The input object must contain a time. If the object is date-only, the function returns a major warning.

Parameters

Examples

The input value for this example is a string in an automatically recognized datetime pattern.

ATL in Script

Result

[[hour('2019-02-06T10:30:15')]]

10

The input value for this example is a datetime object.

ATL in Script

Result

[[
dateTimeString = '06/02/2019T10:30:15';
dateTimeObject = parseDateTime(dateTimeString, "dd/MM/yyyy'T'HH:mm:ss");
hour(dateTimeObject)
]]

10

The second line creates a datetime object by applying parseDateTime to a datetime string in a non-recognized pattern. The final line gets the hour value from the object.