0 pts.
 Julian to Gregorian Date Conv. in DB2 Web Query
I have a julian dates stored in the format YYDDD numeric, 5 positions, zero decimal. How do I convert to a true Gregorian date in DB2 Web Query for iSeries?

Software/Hardware used:
ASKED: November 7, 2007  4:22 PM
UPDATED: November 15, 2010  6:41 PM

Answer Wiki:
The following link is to a draft of a Redbook for DB2 Web Query. Chapter 12 has info on data manipulation. http://www.redbooks.ibm.com/redpieces/pdfs/sg247214.pdf In addition, youu can manipulate dates in the Report Assistant using a computed field. Create a new computed field and in the box where the calculation is needed put something like this: JULIAN/I5 = JULDAT(<i>YOUR_DATE_FIELD</i>, JULIAN); AND GREG_DATE/I8 = GREGDT(JULIAN, 'I8');
Last Wiki Answer Submitted:  December 6, 2007  7:46 pm  by  WaltZ400   645 pts.
All Answer Wiki Contributors:  WaltZ400   645 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Thanks, WaltZ. I read that section but it seems to be only for the developer workbench, which we don’t have.

 0 pts.

 

RPGLE julian date conversion code:

D Wprthr S 8 0 Inz(20101115)
D Xcjul S 7 0

/Free
Xcjul = %Dec(%Subst(%Char(Wprthr):1:4):4:0) * 1000 +
%Diff(%Date(Wprthr):
%Date(%Dec(%Subst(%Char(Wprthr):1:4):4:0)
* 10000 + 0101) :*D) + 1;

XCJUL = 2010319

 10 pts.