Solved Convert a text string date to dd/mm/yyyy

Number11

Member
Local time
Today, 10:22
Joined
Jan 29, 2020
Messages
619
Hwllo, so i am trying to confirm a date string and format as date

20231129 would be 29/11/2023

what's the best way to confirm via query
 
If you add 2 dashes, you have ISO date pattern, and Access can handle it:
? IsDate("2023-11-29")
True
 
Depending on your situation, you might also be able to do it the other way.
Code:
?Format(#29/11/2023#, "yyyymmdd")="20231129"
(untested)
Just a thought...
 
As Tom says just add some - to your string and access will accept it as a date

Code:
RealDate:  DateValue(Left(MyString,4) & "-" & Mid(MyString,5,2) & "-" &  Right(MyString,2))
 
Last edited:
Thanks all i got it working using

RealDate: DateSerial(Left([T_Date], 4), Mid([T_Date], 5, 2), Right([T_Date], 2))

20231130 = 30/11/2023 :)
 

Users who are viewing this thread

Back
Top Bottom