In my database file I have a field for century and a field for date. The date field is in format YYMMDD. I want to print the date in a query in the format of MMDDCCYY with editing(if possible). Fields before converting 20 010426, fields after 04/26/2001. Is there a way to do this in Query/400?
In order to convert and format the fields, you must use result fields in your query. Give an century field "CC", and a date field "YMD", you need 2 fields (as the expressions won't fit on one field).
Result Field: Expression:
MMDD substr(digits(ymd),2,2) || '/' || substr(digits(ymd), 5, 2) MMDDCCYY mmdd || '/' || digits(cc) || substr(digits(ymd), 1, 2)
That should do it.
This was first published in May 2001