Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Date Convertion

Former Member
0 Likes
570

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.

4 REPLIES 4
Read only

anversha_s
Active Contributor
0 Likes
538

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

Read only

Former Member
0 Likes
538

use this FM 'CONVERSION_EXIT_IDATE_OUTPUT'

Read only

Former Member
0 Likes
538

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.

Read only

Former Member
0 Likes
538

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