How do I convert number to a date format in MS Access



I am having a number field in yyyymmdd format. wants to convert into date
field as yyyy/mm/dd in MS Access
thanks for the help


Hello there,

One way is to create a Query, add your field in the desing view and create
also another field as follows:

MyDate: Left([YourFieldName];4) & "/" & Mid([YourFieldName];5;2) & "/" &

You can now use the query to update a newly created field in your table.

Hope this helps.


Ο χÏήστης "chinky" έγγÏαψε:

Duane Hookom

I try not to write expressions that don't explicitly change data from one
type to another and then back again. I also don't like to create complex
expressions/calculations that might be useful in several places in an
application. Consider using a small function like the following which you
can paste into a new module and save it as "basDateConversions". Then, in a
query, you can call it like:

TrueDate: ConvertYMD([YourYYYYMMDDFieldName])

Function ConvertYMD(varDate As Variant) As Date
Dim intYear As Integer
Dim intMth As Integer
Dim intDay As Integer
If IsNull(varDate) Then
ConvertYMD = 0
intYear = varDate \ 10000
intMth = (varDate Mod 10000) \ 100
intDay = varDate Mod 100
ConvertYMD = DateSerial(intYear, intMth, intDay)
End If
End Function

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Excel date format YYYYMMDD 1
convert date 1
Text to date format? 0
Convert Date 3
Convert Date 1
Append/Update Query 6
how do I change the date format from yyyymmdd to mm/dd/yyyy 4
Date Question 6