date functions

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

Guest

I have a query that is looking at a text filed showing a date like this
19990431 I need that format changed to be a date field so i can run a start
date and an end date can anyone help me i will appreciate this greatly.
 
If the Date field has a fixed size of yyyymmdd you can use this

Select CVDate(Right(FieldName,2) & "/" & Mid(FieldName,5,2) & "/" &
left(FieldName,2)) As DateField From TableName

So the date returned should be 31/04/1999
 
One method would be

CDate(Format([YourDateField],"@@@@-@@-@@"))

You will get an error with this if the value of YourDateField is null. You
can either test for this with an IIF statement or filter out records where
your date field is null

IIF([YourDateField] is null,
null,CDate(Format([YourDateField],"@@@@-@@-@@")))
 

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