Convert Date

J

Jennifer

Our DB2 tables has the create date field data type as "text" with the
yyyymmdd format. I'm trying to convert to mm/dd/yyyy; but also need to change
it to date/time data type so I can link to another table.

Any suggestions?

Thanks
Jennifer
 
M

Marshall Barton

Jennifer said:
Our DB2 tables has the create date field data type as "text" with the
yyyymmdd format. I'm trying to convert to mm/dd/yyyy; but also need to change
it to date/time data type so I can link to another table.


DateSerial(Val(Left(CreateDate,4)),
Val(Mid(CreateDate,5,2)), Val(Right(CreateDate,2)))

The display format you want can be specified wherever you
want to dissplay the date/time.

Note that the time part will be midnight so It's not at all
clear how that can be needed in a link to another table.
 

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

Similar Threads

Append/Update Query 6
Convert Date 3
Excel date format YYYYMMDD 1
Convert Numeric field to Date 8
query on date 1
How do I convert "yyyymmdd" to "mm/dd/yyyy via a query 3
Converting Text to Date 8
convert a date 4

Top