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)

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


Dig Deeper on RPG iSeries programming

Join the conversation

1 comment

Send me notifications when other members comment.

Please create a username to comment.

You can achieve the same thing in just one step wih the following command:

DATE(SUBSTR((DIGITS(T01.SDDGL +
1900000)),2,7))
Cancel

-ADS BY GOOGLE

SearchDataCenter

Close