Skip to Content
author's profile photo Former Member
Former Member

Date Convertion

Hello

Does anybody know a function module to convert the date format from 10.01.2007 to January 10th of 2007?

Is it possible?

10nks!!

Gabriel P.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jan 10, 2007 at 07:53 AM

    hi,

    chk this.

    DATA: DATE_CHAR(20).
    DATA: DATE TYPE SY-DATUM.
    DATA: MONTH_NAME LIKE T247-LTX.
    DATE = SY-DATUM.
    
    SELECT SINGLE LTX FROM T247
    INTO MONTH_NAME
    WHERE SPRAS = SY-LANGU
    AND MNR = SY-DATUM+4(2).
    
    CONCATENATE SY-DATUM+6(2) MONTH_NAME SY-DATUM(4)
    INTO DATE_CHAR SEPARATED BY SPACE.
    
    WRITE: / DATE_CHAR.

    Regards

    Anver

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 07:59 AM

    use this FM 'CONVERSION_EXIT_IDATE_OUTPUT'

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 08:15 AM

    hi Gabriel,

    Try this way ..

    * Using Function modules
    ************************
      data: gd_date(8).  "field to store output date
    
    * Converts date from 20010901 to 01SEP2001
      gd_date   = sy-datum.
      CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'
        EXPORTING
          input         = gd_date
        IMPORTING
          OUTPUT        = gd_date.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 10, 2007 at 09:16 AM

    Hi,

    Check this code,

    Suppose a date is given in the format 20050428 how to get the output in the format 28th Apr 2005.

    FORM set_text_date. 
    
    DATA: month(9), 
          year(4), 
          date(2). 
    
    CASE p_frd+4(2). 
    
    WHEN '01'. 
      month = 'January'. 
    
    WHEN '02'. 
      month = 'February'. 
    
    WHEN '03'. 
      month = 'March'. 
    
    WHEN '04'. 
      month = 'April'. 
    
    WHEN '05'. 
      month = 'May'. 
    
    WHEN '06'. 
      month = 'June'. 
    
    WHEN '07'. 
      month = 'July'. 
    
    WHEN '08'. 
      month = 'August'. 
    
    WHEN '09'. 
      month = 'September'. 
    
    WHEN '10'. 
      month = 'October'. 
    
    WHEN '11'. 
      month = 'November'. 
    
    WHEN '12'. 
      month = 'December'. 
    
    WHEN OTHERS. 
    
    ENDCASE. 
    
    WRITE p_frd+0(4) TO year. 
    
    WRITE p_frd+6(2) TO date. 
    
    CONCATENATE month date ',' year INTO return_date SEPARATED BY space. 
    
    CONDENSE return_date. 
    
    ENDFORM.

    http://www.sap-img.com/abap/abap-program-output-of-date-format.htm

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.