ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Data Structure

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

  • Data Structure

    Variable
    S1DATE 8Y 0O 6 50EDTCDE(Y) = 03012012
    MMDDYYYY

    I want to convert this to numeric 8P, 0 = 20120312
    YYYYMMDD

    What is the best method to convert?

    DAC

  • #2
    Re: Data Structure

    use %DATE() bifs
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #3
      Re: Data Structure

      %char(%Date(%char(WorkDate8):*ISO0):*EUR0)
      Thanks
      Venkat

      Comment


      • #4
        Re: Data Structure

        Code:
        d displaydate     s              8                                               
        d Isodate         s               D                                              
        d Mydate          s              8  0 inz(20120312)                              
        d reply           s              1                                               
        d usadate         s              8  0                                            
                                                                                         
         /free                                                                           
                      *inlr = *on;                                                       
                      test(de) *iso  Mydate;                                             
                      if not%error;                                                      
                       Isodate = %date(Mydate:*iso);                                     
                       usadate = %dec(Isodate:*usa);                                     
                                                                                         
                       displaydate = %editc(usadate:'X');                                
                       dsply displaydate reply;                                          
                                                                                         
                      endif;                                                             
         /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