Q

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.
John


This was first 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.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close