Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert yyyymmdd number or string to true Date value in MS Access

I have a query that has a date field in this format (yyyymmdd) just numbers. I am reformatting the the field by creating a calculated field using the following formula:

[DateField] = Date(Left( [DateField] ,4),Mid( [DateField] ,5,2),Right( [DateField] ,2))

I keep getting a message saying my formula contains wrong number of arguments!! This formula always worked in Excel.

Please advise

Cheers

like image 776
infojunkie2004 Avatar asked Dec 25 '22 15:12

infojunkie2004


1 Answers

In Access you'll need to use the DateSerial() function:

DateSerial(Left([DateField], 4), Mid([DateField], 5, 2), Right([DateField], 2))
like image 129
Gord Thompson Avatar answered Apr 30 '23 06:04

Gord Thompson