Syntax
TimeSerial(Hour, Minute, Second)
Remarks
Returns the serial number of the specified time. Because serial numbers are decimal numbers representing a number of days, TimeSerial() returns a decimal number from 0 to 0.99998842592593. For more information about serial numbers, see DateSerial().
Argument | Explanation | |
Hour | A number between 0 and 23, inclusive, or a numeric expression | |
Minute | A number between 0 and 59, inclusive, representing the minutes after the hour, or a numeric expression | |
Second | A number between 0 and 59, inclusive, representing the seconds after the minute, or a numeric expression |
Example
This example displays a message box with a decimal number corresponding to the fraction of the current day that has passed:
h = Hour(Now()) m = Minute(Now()) s = Second(Now()) fraction = TimeSerial(h, m, s) MsgBox Left$(Str$(fraction), 5) + " of this day is over."
See Also
DateSerial(), Day(), Month(), Now(), Time$(), TimeValue(), Today(), Year()