2007 May 03 3:30 PM
how to change the Date format 20070402 to 02/04/2007.
Please provide the logic.
2007 May 03 3:40 PM
constants : c_backslash type c value '/'.
data : v_dat type sy-datum,
v_dat1 type char10.
concatenate v_dat+6(2)
c_backslah
v_dat+4(2)
c_backslash
v_dat+0(4)
into
v_dat1.
2007 May 03 4:09 PM
Hi,
Check the following code:
DATA: VDATE(10) TYPE C
CONCATENATE sy-datum6(2) sy-datum4(2)
sy-datum+0(4) INTO VDATE
SEPARATED BY '/'.
Hope this helps.
Reward if helpful.
regards,
Sipra
2007 May 03 4:11 PM
data: v1(2) type c,
v2(2) type c,
v3(4) type c,
v_date(10) type c.
v1 = date+6(2).
v2 = date+4(2).
v3 = date+0(4).
concatenate v1 v2 v3 into v_date separated by '/'.
write:/ v_date.
2007 May 03 9:30 PM
2007 May 03 9:57 PM
HI
Date = YYYYMMDD
Concatenate date4(2) / date6(2) / date(4) into Date2.
or
data : l_date(10) type c .
concatenate sy-datum6(2) '/' sy-datum4(2) '/' sy-datum(4) into l_date.
write : l_date.
or
data :l_date(10) type c
CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
EXPORTING
DATE_INTERNAL = SY-DATUM
IMPORTING
DATE_EXTERNAL = l_date.
this function module converts date from 20050601 to external format which is specified in user profile.
or
PARAMETERS: P_DATE LIKE SY-DATUM.
DATA: T_MONTHS LIKE STANDARD TABLE OF T247 WITH HEADER LINE.
DATA: DATE LIKE AUSP-ATWRT.
CALL FUNCTION 'MONTH_NAMES_GET'
TABLES
MONTH_NAMES = T_MONTHS.
READ TABLE T_MONTHS WITH KEY MNR = P_DATE+4(2).
DATE(2) = P_DATE+6(2).
DATE+2(3) = T_MONTHS-KTX.
DATE5(2) = P_DATE2(2).
WRITE DATE.
Regards
Laxmi
2007 May 03 11:51 PM
Hi Vamsi,
DATA: date(10),
v1(2) ,
v2(2),
v3(4),
v_date(10).
date = 20070402.
v1 = date+6(2). " it writes 02
v2 = date+4(2). " it writes 04
v3 = date+0(4). " it writes 2007
concatenate v1 v2 v3 into v_date separated by '/'.
write:/ v_date.
Regards,
KK