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

Print

In Access, the DateSerial function returns the date for a specific year, month, and day.

The syntax for the DateSerial function is:

DateSerial ( year, month, day )

The DateSerial function returns a date that is stored internally as a double-precision number. This number represents a date from January 1, 100 through December 31, 9999. If the date specified by the three arguments, either directly or by expression, falls outside the acceptable range of dates, an error occurs.

year is a number between 100  and 9999, inclusive, that represents the year value of the date.

month is a number between 1 and 12, inclusive, that represents the month value of the date.

day is a number between 1 and 31, inclusive, that represents the day value of the date.

Examples

DateSerial (2004,3,24 )         returns 03/24/2004
DateSerial(1998,7-5,17 )        returns 02/17/1998
DateSerial(2000,5,24-9 )        returns 05/15/200

VBA Code

Dim MyDate As Date
MyDate = DateSerial(2005,3,14)

This example uses the DateSerial function to return the date for the specified year, month, and day. Now the MyDate variable would contain the value of 3/14/2005.

SQL query

You can also use the DateSerial function in a query.

SELECT DateSerial(2005,7,21) 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.