Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

convert character date to true date

Status
Not open for further replies.

twes3

Programmer
Jun 1, 2004
16
US
Hello. How do I convert character date field (YYYYMMDD) to a true date field?

Thanks
 
Code:
CDate(Left({MyTable.Field},4),Mid({MyTable.Field},3,2),Right({MyTable.Field},2))

Gary Parker
MIS Data Analyst
Manchester, England
 
use the date function in a formula

eg.
date({yourtable.datecharField})

then simply right click on the formula field and format as you see fit to any date format available.

just in case you should also put a check to make sure that it will always return a date

eg

if IsDate ({yourtable.datecharField}) = true then
date({yourtable.datecharField})


Mo
 
Sorry the isdate check and date option won't work without dividers on the string


Mo
 
dgillz

There is no NumberToDate function in CR10 is this new to CRXI ?

Gary

Gary Parker
MIS Data Analyst
Manchester, England
 
Try:

CDate(Val(Left({MyTable.Field},4)),Val(Mid({MyTable.Field},5,2)),Val(Right({MyTable.Field},2)))

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top