The TimeSerial function in VBA returns a Time for the specified hour, minute, and second.

Syntax

Parameter

Hour (required) – This parameter represents an integer (0 to 23), signifying the hour of the time.

Minute (required) – This parameter represents an integer (0 to 59), signifying the minute of the time. If it is less than 0 or greater than 59, this value is subtracted from, or added to, the specified number of hours.

Second (required) – This parameter represents an integer (0 to 59) representing the second of the time. If it is less than 0 or greater than 59, this value is subtracted from, or added to, the specified number of minutes.

Return

This function returns a Time for the given hour, minute, and second.

Example 1

Output

9:56:45 AM

VBA TimeSerial Function

Example 2

Output

8:59:45 AM

VBA TimeSerial Function

Example 3

Output

9:01:00 AM

VBA TimeSerial Function

Pin It on Pinterest

Share This