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
|
VBA Code
|
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.
|