Skip to main content

HOUR

Use the HOUR function to returns the hour of a time or date/time value. The hour is given as a number ranging from 0 (12:00 AM) to 23 (11:00 PM).

Use

HOUR( time )
Returns the hour of a time or date/time value.

ParameterRequiredDescription
timeYesthe time or date/time that contains the hour to return

ReturnsNumber

Examples

Path Condition (After-Hours Routing)

You can use HOUR in a Path Condition formula on a Branch step to route an approval based on the time of day it was initiated,.

  • Scenario: A maintenance request is submitted via a trigger. If the request is started after 6:00 PM (18:00) or before 8:00 AM, it should be routed to the "On-Call Engineer" path instead of the "Standard Office" path.
  • Formula: OR(HOUR(@prop.StartedOn) >= 18, HOUR(@prop.StartedOn) < 8)
  • Logic:
    • @prop.StartedOn: This system property retrieves the exact date and time the approval run began,.
    • HOUR(...): Extracts only the hour portion (0–23) from that timestamp.
    • Outcome: If the hour is 18 or higher, or less than 8, the formula returns TRUE, and the workflow follows the "On-Call" path.

Output Validation (Restricting Delivery Windows)

In an Output Validation Formula, you can use HOUR to ensure that a user-entered time falls within an acceptable range,.

  • Scenario: A user is filling out a form to schedule a "Loading Bay Booking." The warehouse only accepts bookings between 10:00 AM and 4:00 PM (16:00).
  • Formula: ASSERT(AND(HOUR(this) >= 10, HOUR(this) < 16), "Bookings must be made between 10 AM and 4 PM.")
  • Logic:
    • this: Refers to the specific Time value currently being entered in the capture widget.
    • HOUR(this): Returns the hour of that input.
    • ASSERT: If the hour is outside the 10–15 range (inclusive), the formula returns FALSE and displays the custom error message to the user,.