Home Privacy Policy Feedback Link to us Site Map Forums

Excel: TimeSerial Function (VBA only)


In Excel, the TimeSerial function returns a time given an hour, minute, and second value.

The syntax for the TimeSerial function is:

TimeSerial( hour, minute, second )

hour is a numeric value between 0 and 23 that represents the hour value of the time.

minute is a numeric value that represents the minute value of the time.

second is a numeric value that represents the second value of the time.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

TimeSerial(14, 6, 30) would return 2:06:30 PM
TimeSerial(20 - 8, 6, 30) would return 12:06:30 PM
TimeSerial(8, 6-2, 14) would return 8:04:14 AM
TimeSerial(7, -15, 50) would return 6:45:50 AM

VBA Code

The TimeSerial function can only be used in VBA code. For example:

Dim LTime As Date

LTime = TimeSerial (23, 5, 31)

In this example, the variable called LTime would now contain the value of "11:05:31 PM".