This function formats a time from a specific hour, minute, and second.
TimeSerial(hour, minute, second)
Returns a Variant of subtype Date.
To specify a time, such as 11:59:59, the range of numbers for each TimeSerial parameter should be in the accepted range for the unit; that is, from 0 through 23 for hours and from 0 through 59 for minutes and seconds. However, you also can specify relative times for each parameter using any numeric expression that represents some number of hours, minutes, or seconds before or after a certain time.
The following example uses expressions instead of absolute time numbers. In this example, TimeSerial returns a time for 15 minutes before (–15) six hours before noon (12–6), or 5:45:00 A.M.
TimeSerial(12 - 6, -15, 0)
When any parameter exceeds the accepted range for that parameter, it increments to the next larger unit as appropriate. For example, if you specify 75 minutes, it is evaluated as one hour and 15 minutes. However, an error occurs if any single parameter is outside the range from –32,768 through 32,767, or if the time specified by the three parameters, either directly or by expression, causes the date to fall outside the acceptable range of dates.