Home page
 
 Home 
 ASP 
 PHP 
 SQL 
 HTML 
 JavaScript 
 Search 
 Contact 
 
Search
or browse popular tags
Access Functions
Subscription

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: DateValue Function

Print

In Access, the DateValue function returns the date represented by the date of a String argument.

The syntax for the DateValue function is:

DateValue ( string )

The argument string is a String representing a date from January 1, 100 through December 31, 9999. It can include a time component, if desired. If string includes only numbers, DateValue recognizes the order for month, day, and year according to the Date Format setting in the International section of the Microsoft Windows Control Panel. If the year part of string is omitted, DateValue uses the current year from your computerís system date. If string includes time information, DateValue does not return it.

Examples

DateValue("May 5")            returns 05/05/2005
DateValue ("May 5,1985")      returns 05/05/1985
DateValue ("11/22/93")        returns 11/22/1993

VBA Code

Dim MyDate As String 
MyDate = DateValue("October 10, 2005")

This example uses the DateValue function to convert a string to a date. Now the MyDate variable would contain the value of 10/10/2005.

SQL query

You can also use the DateValue function in a query.

SELECT DateValue('May 25,2004') AS Expr1
FROM Orders


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




Tags:

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

  • Comments





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