Best way to convert date?
Best way to convert date?
[updated:LAST EDITED ON Apr-15-09 AT 12:34 PM (EST)]If my database only uses dates in the format CCYYMMDD and it stores these as a numeric, what is the best way to convert this to a normal mm/dd/yy or mm/dd//yyyy format?____I would like the output to be a usable true date/time field as opposed to a character field if at all possible.____What I mean is I would like to be able to calculate using other functions after it has been converted.____Thanks____Chris
=> RE: Best way to convert date?
You could first use STR(numval,8) convert the numeric value to a string, e.g., "20090415", then use the pieces of the string in a CTOD function to convert to a date, like this:____CTOD( SUBS(strval,5,2) + "/" + SUBS(strval,7,2) + "/" + SUBS(strval,1,4) )__