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

Converting Julian dates in query

An easy way to convert a Julian date to a normal date 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)


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.

Dig Deeper on RPG iSeries programming