Home page
or browse popular tags
Access Functions

Sign up for the free email newsletter for new tips, tutorials and more. Enter your email address below, and then click the button.

Privacy Policy

RSS Twitter

Access: TimeValue Function


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.


TimeValue ("27/11/2005 4:47:31 AM")     returns '4:47:31 AM'
TimeValue ("4:47:31 AM")                       returns '4:47:31 AM'
TimeValue ("17:22:43")                          returns '5:22:43 PM'

VBA Code

Dim MyTime As String 
MyTime = TimeValue("10:35:54 PM")

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.

SELECT TimeValue('12:45:37') AS Expr1
FROM Orders

If you'd like to see how it works, enter SQL statement and press Execute


Add To: Add to dzone dzone | Digg this digg | Add to del.icio.us del.icio.us | Stumble it stumbleupon

  • Comments

Copyright © 2005-2023             www.WebCheatSheet.com All Rights Reserved.