Is there a Date Time Conversion from text?

D

Dave

I have DateTime stored as text in an Access db field.

Ex: 1/22/2008 10:34:29 AM

I want to convert this data form text to a real DateTime value all
inclusive. I am able to pull the date DateValue and time TimeValue, but is
there a way to get them both together.

Thanks
 
J

John Spencer

Try using CDate or DateAdd
DateAdd("D",0,[Your Text Date Time])
CDate([Your text date time])

If your string field could be null, or a zero-length string, or invalid,
then I suggest you test it first

IIF(IsDate([Your Text Date Time]),CDate([Your Text Date Time]),Null)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
D

Dave

Thanks John, CDate did the trick :)

BTW Is there an easy way to print the response only, I don't see a print
friendly link of a way to just print the response without getting the entire
web page.

John Spencer said:
Try using CDate or DateAdd
DateAdd("D",0,[Your Text Date Time])
CDate([Your text date time])

If your string field could be null, or a zero-length string, or invalid,
then I suggest you test it first

IIF(IsDate([Your Text Date Time]),CDate([Your Text Date Time]),Null)

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..

Dave said:
I have DateTime stored as text in an Access db field.

Ex: 1/22/2008 10:34:29 AM

I want to convert this data form text to a real DateTime value all
inclusive. I am able to pull the date DateValue and time TimeValue, but
is
there a way to get them both together.

Thanks
 

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