Home Privacy Policy Feedback Link to us Site Map Forums

Access: DateSerial Function


In Access, the DateSerial function returns a date given a year, month, and day value.

The syntax for the DateSerial function is:

DateSerial ( year, month, day )

year is a numeric value between 100 and 9999 that represents the year value of the date.

month is a numeric value that represents the month value of the date.

day is a numeric value that represents the day value of the date.


For example:

DateSerial (2004, 6, 30) would return '6/30/2004'
DateSerial (2004-1, 6, 30) would return '6/30/2003'
DateSerial (2004, 6-2, 14) would return '4/14/2004'

VBA Code

The DateSerial function can be used in VBA code. For example:

Dim LDate As Date

LDate = DateSerial (2004, 5, 31)

In this example, the variable called LDate would now contain the value of '5/31/2004'.


SQL/Queries

You can also use the DateSerial function in a query.