Solved Convert a text string date to dd/mm/yyyy (1 Viewer)

Number11

Member
Local time
Today, 08:09
Joined
Jan 29, 2020
Messages
607
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
 

tvanstiphout

Active member
Local time
Today, 00:09
Joined
Jan 22, 2016
Messages
222
If you add 2 dashes, you have ISO date pattern, and Access can handle it:
? IsDate("2023-11-29")
True
 

theDBguy

I’m here to help
Staff member
Local time
Today, 00:09
Joined
Oct 29, 2018
Messages
21,473
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...
 

Minty

AWF VIP
Local time
Today, 08:09
Joined
Jul 26, 2013
Messages
10,371
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:

Number11

Member
Local time
Today, 08:09
Joined
Jan 29, 2020
Messages
607
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

Top Bottom