contents.gifindex.gifprev1.gifnext1.gif

TimeSerial

Purpose

Returns the time for a specific hours, minute, and second.

Arguments

TimeSerial(

hour
//An hour between 0 (12:00 A.M.) and 23 (11:00 P.M), inclusive, or a numeric expression.
, minute
//A minute between 0 and 59, inclusive, or a numeric expression.
, second
//A second between 0 and 59, inclusive, or a numeric expression.
)

Notes

To express a specific time, such as 11:59:59, the range of numbers for each TimeSerial argument should conform to the accepted range of values for the unit. These values are 0 through 23 for hours and 0 through 59 for minutes and seconds. You can also specify relative times for each argument by using a numeric expression representing the number of hours, minutes, or seconds before or after a certain time. The following example uses expressions instead of absolute time numbers. The TimeSerial function returns a time for 15 minutes before (0 - 15) six hours before noon (12 - 6), or 5:45:00 A.M.:

GetTime = TimeSerial(12 - 6, 0 - 15, 0)

The TimeSerial function returns a Variant of VarType 7 (Date) containing a time that is stored internally as a double-precision fractional number between 0 and 0.99999. This number represents a time between 0:00:00 and 23:59:59, or 12:00:00 A.M. and 11:59:59 P.M., inclusive. If the time specified by the three arguments, either directly or by expression, falls outside the acceptable range of times, an error occurs.

Example

In this example, the TimeSerial function returns a Variant of VarType 7 (Date) containing a time specified by the integer arguments.

GetTime = TimeSerial( H, M, S )