In Access, the TimeValue function returns the time represented by a string argument.
The syntax for the TimeValue function is:
TimeValue ( string )
The required string argument is normally a string expression representing a time from 0:00:00 to 23:59:59, inclusive. You can enter valid times using a 12- or 24-hour clock. If time contains Null, Null is returned. If string includes date information, TimeValue does not return it. However, if string includes valid date information, an error occurs.
Examples
|
VBA Code
|
This example uses the TimeValue function to convert a string to a time. Now the MyTime variable would contain the value of ’10:34:54 PM’.
SQL query
You can also use the TimeValue function in a query.
|