ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Retrieving current date in free form to numeric 8,0 field

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

  • Retrieving current date in free form to numeric 8,0 field

    Really stuck on how to retrieve the current date into an 8,0 numeric format in free form RPG/LE.

    (this was so easy with C specs...)

    Result must be YYYYMMDD.

    Code snippet as follows:

    ...
    D ThisDate S D
    D Num80 S 8 0

    //free

    ThisDate = %Date(); // retrieve current date.
    Num80 = ???; // (need help with this piece)

    //End-Free
    EMSS

  • #2
    This should work for you.

    Try this

    Code:
    d CCYYMMDD        s              8  0                
    d ISODate         s               D                  
                                                         
     /free                                               
      eval  Isodate = %Date();                           
      CCYYMMDD = %Int( %Char( Isodate : *ISO0 ) );       
      DSPLY   %char(CCYYMMDD);                           
      eval *INlr = *On;                                  
     /end-free
    or just this
    Code:
    CCYYMMDD = %Int( %Char( %date())) ;
    Please check here also



    take care
    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
      Thanks so much! This is the one that works - from the suggested web page:

      // Todays Date in Ccyymmdd format

      Today = %uns(%char(%Date():*Iso0));
      EMSS

      Comment


      • #4
        Jamie's second option needs modification

        CCYYMMDD = %Int( %Char( %date():*ISO0));

        That's it!!

        Take care,
        Aashish

        Comment

        Working...
        X