ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

quick RPG/free convertion routine for JDE Julian dates

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • quick RPG/free convertion routine for JDE Julian dates

    Anyone have a quick RPG/free convertion routine for JDE Julian dates to ISO and back? JDE uses these funky old called routines.

    JDE format: CYYJJJ

    Where:
    C= 1 = 2000 (no data before year 2000)
    YY = Year
    JJJ = day since Jan 1 of this year. (watch out for leap years)

    eg: 106306

  • #2
    Re: quick RPG/free convertion routine for JDE Julian dates

    sorry big guy had to test it

    PHP Code:
    d TodayISO        S               D   datfmt(*ISO)         
    d TodayJul        S               D   datfmt(*JUL)         
    d juldate         s             05  0 inz(06268)           
    d juldate2        s             05  0 inz(06125)           
    d juldate3        s             05  0                      
     
    *                                                         
     /
    free                                                     
           
    // Convert Date from ccyymmdd to mmddyy             
                                                               
        
    TodayIso = %date(juldate:*Jul);                        
        
    dsply todayiso ' ';                                    
        
    TodayIso = %date(juldate2:*Jul);                       
        
    dsply todayiso ' ';                                    
        
    TodayJul TodayISO;                                   
        
    dsply TodayJul;                                        
        
    juldate3 = %dec(TodayJul:*jul);                        
        
    dsply %editc(juldate3:'X'' ' ;                       
      eval *
    inlr = *on;                                        
     /
    end-free 
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: quick RPG/free convertion routine for JDE Julian dates

      Hi ITP:

      Try this link:



      Hey, Howard: I want to convert a J.D. Edwards date, (CYYDDD where C represents the century, YY represents the year, and DDD represents the day of the year) to a more readable format, (like YYYY-MM-DD). I can do this in Crystal Reports, but is there a way to do it in SQL? — Domenic This


      Jamie It's not quite that easy. The date is 6 numeric with the first position being 0 for 1900 and 1 for 2000 followed by yyddd.

      Best of Luck
      Gary
      Last edited by GLS400; November 6, 2006, 12:06 PM. Reason: wrong link
      The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

      Comment


      • #4
        Re: quick RPG/free convertion routine for JDE Julian dates

        I should learn to read better

        thanks gary for pointing this out

        I found this in http://www.code400.com/funwithdates.php

        Code:
        Deriving a Date from a J.D. Edwards (CYYJJJ) Date
        
        ResultDate = %date(JDEDate + 1900000 : *longjul);
        
        Deriving a J.D. Edwards Date from a Date:
        
        JDEDate = %int(%char(MyDate:*longjul0) ) –  1900000;
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: quick RPG/free convertion routine for JDE Julian dates

          that rocks Jamie!!

          Comment

          Working...
          X