Problem solve Get help with specific problems with your technologies, process and projects.

The field for the date in the database

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 last published in May 2001

Dig Deeper on Systems Management Tools

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.