ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Converting chartacter to a date

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

  • Converting chartacter to a date

    Hi All ,

    I need to convert a date time value which is in character to a date ...
    e, g
    The Variable Cdate = 20080522103540

    What i want is to convert it into numeric only after adding +1 to a minute

    e,g

    20080522103540 after adding 1 to a minute should give me
    20080522103640 and then move it to a numberic variable of 14 length ..

    Is therea function which can convert a character to a date time stamp or
    i need to use the substring function .. and need to take care of the 59 minute and 59 second as well ...

    Thanks
    Ashwani ...

  • #2
    Re: Converting chartacter to a date

    Code:
    @dateA = %date(@charB:*usa/);
    & MORE

    Comment


    • #3
      Re: Converting chartacter to a date

      Maybe something like this.

      Code:
           D CDate           S             14A                    
           D MillSec         S              6A   Inz('000000')    
           D                 DS                                   
           D NumTime                 1     20S 0                  
           D Num14                   1     14S 0                  
           D                                                      
            /FREE                                                 
             CDate = '20080522103540';                            
             NumTime  = %dec(%timestamp(CDate + MillSec:*ISO0)    
                 + %minutes(1));                                  
             *INLR = *on;                                         
            /END-FREE

      Comment

      Working...
      X