Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert a text string to a date? 1

Status
Not open for further replies.

mmck1964

Technical User
Jul 12, 2001
104
US
I have a database where the date is a text string.
[Date] [Would like it to be]
112904 11/29/2004
91807 09/18/2007
12206 01/22/2006
101305 10/13/2005
1/15/98 01/15/1998

I am trying to do this in a query.
Thanks!
 


Code:
DateSerial(IIF(RIGHT(RIGHT("0"&replace([Date],"/",""),6),2)<"20","20","19")
&RIGHT(RIGHT("0"&replace([Date],"/",""),6),2),LEFT(RIGHT("0"&replace([Date]
,"/",""),6),2),MID(RIGHT("0"&replace([Date],"/",""),6),3,2))

working in two different applications, sorry.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Thank-You!!!! It works!!!!!!

Thanks for your patience.
 
Hi Skip,

I am going through the same problem as well, only with a slight difference in the text string.

the text dates that i receive all have the same number of digits.

i.e. "06/10/2007"

i tried using dateserial:

DateSerial(Left([LAST_SUNDAY],2),Mid([last_sunday],4,2),Right([last_sunday],4))

but the result = 3/29/2012 for "06/10/2007"

please advise.

THanks so much
Hosacans
 



Hosacans,

Please post your question in a NEW thread.

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top