|
I found a set of code published in the was published in Midrange Computing in November 1988 issue. This is one of the code which works great. Hope this answer your question. There are two programs involved one is to convert the gregorian date to julian date (ie. this is not YYJJJ format it is relative number to the date passed), and another is to convert the julian date to gregorian date. The program names used are the orginall code from Midrange Computing. GTOJR1 (RPG) C *ENTRY PLIST C PARM G$MM 20 C PARM G$DD 20 C PARM G$YYYY 40 C PARM G$JD 50 C* C Z-ADD0 G$JD C G$MM SUB 3 G$MMWK 20 C Z-ADDG$MMWK GMWKSV 20 C G$MMWK IFLT 0 LVL-01 C ADD 12 G$MMWK C END END-01 C GMWKSV IFNE 0 LVL-01 C G$MMWK MULT 30.6 G$JD H C END END-01 C ADD G$DD G$JD 50 C G$YYYY SUB 1900 G$YYWK 30 C G$YYWK IFNE 0 LVL-01 C GMWKSV IFLT 0 LVL-02 C SUB 1 G$YYWK C END END-02 C END END-01 C G$YYWK MULT 365.25 G$JYD 70 C ADD G$JYD G$JD C G$JD DIV 7 G$WK7 70 C MVR G$DW 10 0=Wed-6=Tue C RETRN JTOGR1 (RPG) C *ENTRY PLIST C PARM J$JD 50 C PARM J$MM 20 C PARM J$DD 20 C PARM J$YYYY 40 C* C J$JD DIV 365.25 J$YYWK 30 C J$JD DIV 365.25 J$TST 99 C J$TST IFEQ 0 LVL-01 C SUB 1 J$YYWK C END END-01 C J$YYWK MULT 365.25 J$YD 70 C J$JD SUB J$YD J$YD C J$YD IFGT 306 LVL-01 C ADD 1 J$YYWK C END END-01 C Z-ADD0 J$X 20 C J$YD DOULEJ$MD LVL-01 C ADD 1 J$X C J$X MULT 30.6 J$MD 30H C END END-01 C SUB 1 J$X C J$X MULT 30.6 J$MD H C J$YD SUB J$MD J$DD 20 C J$X ADD 3 J$MM 20 C J$MM IFGT 12 LVL-01 C SUB 12 J$MM C END END-01 C J$YYWK ADD 1900 J$YYYY 40 C SETON LR C RETRN Hope this will answer your question. Thanks to Midrange Computing. Venkat Sreenivasan vsreenivasan@yahoo.com "keshava narasimha" <anandthirta@hotmail.com> on 10/13/99 12:51:03 PM Please respond to RPG400-L@midrange.com To: RPG400-L@midrange.com cc: (bcc: Venkat Sreenivasan/IT/MIA/RCL) Subject: date function-clarify Hi ! Let me be more clear on my question first... I have a date 1999/12/12 o.k..When I convert this date into days I you get a figure. (like 3457899) Now if need to display tomorrows date , I add 1 to this number and how do I display 1999/12/13 is the Question?(the function needs to be done using RPG/400 only not ILERPG) Thanks for all your time. Keshav ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.