Tip

Converting Julian dates in query

I have to regularly run queries over files that have Julian dates as fields. These are often files from JDE. The format would be 99011, or 100350. To convert that to a "readable" format would mean a CL program, or RPG. The date comes out as 11/01/99, or 15/12/00.

Luckily, standard query can do that for you. Go to "Define result fields" and create these fields. GLDGJ would be your Julian date field, and GLDAT would be your new work field. Works for pre-and post 2000.

To convert a Julian date to a normal date in query:

 
NDAT        1900000 + gldgj         7  0

CDAT        digits(ndat)

GLDAT       date(cdat)

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your programming questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.


This was first published in January 2004

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.