date format

G

Guest

im sorry for my ignorance but i need help with i suppose a quite simple
problem.

i got two imported text fields.
These two text fields got date informtion presented in yyyymmdd ie 20060802
(the shortdate in my zone is yyyy-mm-dd)

I understand i need to change the format to Date/Time before calculating the
datediff. I cant use the shortdate and therefore been trying to use the
format yyyymmdd but cant get it to work.

could someone please help me ?
 
D

Douglas J. Steele

To change a text field in yyyymmdd format to a date field, try:

CDate(Format(TextDate, "0000\-00\-00"))

That format statement will convert the text to yyyy-mm-dd, which CDate can
then recognize.
 

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

Top