Home» » Access Convert Date Serial Number

Access Convert Date Serial Number

0Home

MS Access: DateSerial Function This MSAccess tutorial explains how to use the Access DateSerial function with syntax and examples. Description The Microsoft Access DateSerial function returns a date given a year, month, and day value. Syntax The syntax for the DateSerial function in MS Access is: DateSerial ( year, month, day ) Parameters or Arguments year A numeric value between 100 and 9999 that represents the year value of the date.

Month A numeric value that represents the month value of the date. Day A numeric value that represents the day value of the date. Returns The DateSerial function returns a date value.

Applies To The DateSerial function can be used in the following versions of Microsoft Access: • Access 2016, Access 2013, Access 2010, Access 2007, Access 2003, Access XP, Access 2000 Example Let's look at how to use the DateSerial function in MS Access: DateSerial (2004, 6, 30) Result: '6/30/2004' DateSerial (2004-1, 6, 30) Result: '6/30/2003' DateSerial (2004, 6-2, 14) Result: '4/14/2004' Example in VBA Code The DateSerial function can be used in VBA code in Microsoft Access. 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'. Example in SQL/Queries You can also use the DateSerial function in a query in Microsoft Access. For example: In this query, we have used the DateSerial function as follows: Expr1: DateSerial(2004,3,12) This query will use the DateSerial function to construct a date based on 2004 as the year, 3 as the month, and 12 as the day values.

I'm using a text data type (for numerous reasons, using date data-type is not an option) for my Dates columns and they were all running fine but after changing data types and changing them back, they all became serial numbers. Can't figure out how to convert them back to dates whilst still in the text.

The results will be displayed it in a column called Expr1. You can replace Expr1 with a column name that is more meaningful. For example: DateValue: DateSerial(2004,3,12) The results would now be displayed in a column called DateValue. Install Firebug Firefox Portable Dowload more.

Access Convert Date Serial Number