Hour Function

Purpose

Returns a whole number between 0 and 23, inclusive, representing the hour of the day.

Syntax

Hour(time)

time: Date, Variant, or String

Description

The time argument is any expression that can represent a time. If time contains Null, Null is returned.

The following example uses the Hour function to obtain the hour from the current time:

Example

Debug.Show

Local z As Date, x%

z = HmsToTime(110000, 20, 4000)

Trace z

Trace Hour(z)

Trace Hour(#16:24:12#)

Trace Hour(Now)

Trace Hour(Time)

Trace Hour(FileDateTime("c:\windows\notepad.exe"))

Remarks

The format of the output can be changed with the using of Mode Date..., Mode Format..., Format....

See Also

CDate(), Date, Date$, DateAdd(), DateDiff(), DatePart(), DateSerial(), DateTime$(), DateToDmy, DateToDmyHms, DateValue(), Day(), DayNo(), DmyHmsToDate(), DmyToDate(), HmsToTime(), Hour(), IsDate(), Minute(), Month(), Now, Now$(), TimeSerial(), TimeToHms, TimeValue(), Second(), Week(), WeekDay(), Year()

{Created by Sjouke Hamstra; Last updated: 09/10/2014 by James Gaite}