Convert Text to Date

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

Guest

What is the most efficient way to convert a text string in the form of
20060218 to a short date? Thanks!
 
Assuming that the field always have the same formt
yyyymmdd

Try
cvdate(format(FieldName,"####/##/##"))
 
AllyOop said:
What is the most efficient way to convert a text string in the form of
20060218 to a short date? Thanks!

Short date is a format, which is irrelevant to the value.

To get a date value from that kind of string:

DateSerial(Left(txtstr,4), Mid(txtstr, 5,2), Right(txtstr,2)

To format the date value set the Format property of the text
box that you're using to display the 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