ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Change Date Format in RPGLE

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

  • Change Date Format in RPGLE

    I have a date field in yyyymmdd format. I want to change the format into ddmmyyyy. But i don't want to chop the field and move here move there. Is it any key word can help me change the format one shot?

  • #2
    converting dates

    colourwolf82 there are many date conversion examples on this site.

    see==>


    Code:
         d WorkDAte8    s              8  0
         d WorkDateEUR  s              8  0
    
    
         c                   eval      WorkDateEUR =
         c                             %uns(%char(%Date(%char(WorkDate8):*ISO0)
         c                             :*EUR0))

    Please let us know if your questions are being answered, this is your third post and I'm not sure if we have provided any valuable information.

    Thanks
    Jamie
    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
      if at v5r1 or before

      if at V5R1 or below

      You can use this

      Code:
           D AnyDate         s               d   datfmt(*eur)
           C*
           C*  OLDELT is a decimal field in data file with length of 8,0
           C*  Test(de) = Test date for error if error %Error = *On
           C*
           C     *ISO          Test(de)                OLDELT      
           C                   If        Not%Error
           C     *ISO          Move      OLDELT        AnyDate
           C                   endif

      or play around with this

      Code:
                 H bnddir('QC2LE')   
      	  D atoll           pr            20i 0 extproc('atoll')   
      	  D  string                         *   value options(*string)
      	  
      	  /free 
      	  numDate = atoll(%char(date : *eur0));
                 /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

      Working...
      X