Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert a string to a date in Access

Tags:

sql

ms-access

I'm migrating data between tables in Access 2003. In the old table, the date was stored as a text field in the format YYYYMMDD.

I want to store the field as a datetime in the new table. I've tried using CDate() in my SQL statement, but it just displays as #Error in the results.

What am I doing wrong?

like image 338
Margaret Avatar asked Oct 30 '25 05:10

Margaret


1 Answers

e.g. cdate(format("20091231", "####/##/##"))

So, in your case it will be

SELECT cdate(format(mystringFieldThatIsInYYYYMMDDFormat, "####/##/##"))   
FROM myData
like image 176
shahkalpesh Avatar answered Oct 31 '25 18:10

shahkalpesh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!