Converting string to Date

J

Jim Scarlett

Hello! I have inherited a DB containing dates as nvarchar 50!! Is there a
function to convert this to a genuine datetime datatype?
 
J

John Nurick

Hi Jim,

There are zillions of ways of representing dates as text. The built-in
CDate() function will convert some of them; otherwise the usual
technique is to parse the string into numbers representing year, month
and day (using VBA functions such as Left(), Mid(), InStr()) and then
pass these to the DateSerial() function which combines them into returns
a date value.
 
Top