hour

Extracts the hour of the day from a date/time object.
Ordinal value of the hour, in the range 0 - 23.

hour(date) → returns Numeric

Member Function Syntax

date.hour()

Argument Reference for the hour function

date

Required: Yes
Values:
  • now()

Compatibility

ColdFusion:

Member function is available in CF 11+.

Lucee:

Member function is available in Lucee 4.5+.

Examples sample code invoking the hour function


Hour of a datatime object

dt = createdatetime(2016,1,1,5,30,25);
h = hour( dt );
writeoutput( h );

Expected Result: 5


Current Hour of the day

hour( now() )

Fork me on GitHub