Convert Text String to Date

SteveGMC

Registered User.
Local time
Today, 21:54
Joined
Dec 13, 2009
Messages
20
Hi, this is driving me nuts :( I've done it before for something similar, but i can't remember where

I have a export in CSV that I've imported to a temp table. The Date is stored as

Code:
20101001
YYYYMMDD

Before I'm sure I used an example using MID, but I can't find it. I've seen the use of Cdate and Format functions, but no real example of how to use them in my case.

Are there any examples I can take a look at?
 
Its OK, sussed it I think using this

Code:
DateProcEnd: DateSerial(Left([DateProcEnd_YYYYMMDD],4),Mid([DateProcEnd_YYYYMMDD],5,2),Right([DateProcEnd_YYYYMMDD],2))

If there's room for improvement please point it out! :)
 
No room for improvement, this is the only way to do it
 

Users who are viewing this thread

Back
Top Bottom