Excel: TimeValue Function
In Excel, the TimeValue function returns the serial number of a time.
The syntax for the TimeValue function is:
TimeValue( time_value )
time_value is a string representation of a time.
Applies To:
- Excel 2007, Excel 2003, Excel XP, Excel 2000
For example:
Let's take a look at an example:

Based on the spreadsheet above, the function would return the following values:
=TimeValue(A1) would return 0.584733796 =TimeValue(A2) would return 0.084733796 =TimeValue(A3) would return 0.646261574 =TimeValue("5:12:00 AM") would return 0.216666667
VBA Code
The TimeValue function can also be used in VBA code. For example:
Dim LTime As Date
LTime = TimeValue("18:30:12")
In this example, the variable called LTime would now contain the value of 6:30:12 PM.
