Converting string to Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello! I have inherited a DB containing dates as nvarchar 50!! Is there a
function to convert this to a genuine datetime datatype?
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top