‎2008 May 23 1:47 PM
Hi All,
How to convert the date 20080523 into 05/23/2008. pls provide me the code.
Regards
Sami
‎2008 May 23 1:50 PM
Hi,
data: v_date type sy-datum value '20080523'.
data: v_result(10).
concatenate v_date4(2) v_date6(2) v_date+0(4) into v_result separated by '/'.
write:/ v_result.
Edited by: Velangini Showry Maria Kumar Bandanadham on May 23, 2008 2:52 PM
‎2008 May 23 1:51 PM
Hi,
You can use this function module:
CONVERT_DATE_TO_EXTERNAL
in import the variable should be of char type.
‎2008 May 23 1:51 PM
Hi,
Check the code below:
data: v_var1(10) type c,
v_var2 type sy-datum.
v_var2 = sy-datum.
CONCATENATE v_var2+4(2) '/' v_var2+6(2) '/' v_var2+0(4) INTO v_var1.Regards
Kannaiah
‎2008 May 23 1:54 PM
Use write Statment:
data : date(10).
write sy-datum to date mm/dd/yyyy. " writes 20080924 as 09/24/2008 in date.
‎2008 May 23 1:57 PM
Also need add some code for this:
DATA: X TYPE D VALUE '20080523',
Y(10) .
WRITE X MM/DD/YYYY TO Y.
REPLACE ALL OCCURRENCES OF '.' IN Y WITH '/'.
WRITE Y.
‎2008 May 23 2:01 PM
Hello,
Use this:
WRITE sy-datum TO lv_variable MM/DD/YYYY.
The content of a data object of type d is interpreted as a valid date in the format YYYYMMDD and is output as follows for the individual additions:
DD/MM/YY and MM/DD/YY:
Both additions have the same effect. The date output has a two-digit year value and a separator. The separator and the order are taken from the definition for date output in the user master record.
DD/MM/YYYY und MM/DD/YYYY:
Both additions have the same effect. The date output has a four-digit year value and separator. The separator and the order are taken from the definition for date output in the user master record.
DDMMYY und MMDDYY:
Both additions have the same effect. The date output has a two-digit year value and no separator. The order is taken from the definition for date output in the user master record.
YYMMDD:
This addition provides a date output with a two-digit year value without a separator in the format YYMMDD.
If the output length is defined implicitly or specified using len, this is used. If it is too short, the edited output is cut off to the right. If the output length is specified using * or **, it is set to the length of the specified edit mask (6, 8, or 10).
Note
The behavior for abbreviation differs from the output of a data in accordance with the user master record, where the separator is removed first and then cut off.
Regards,
‎2008 May 23 10:43 PM
Hi, Check this out.
data: date1 type sy-datum value '20080523'.
data:result(10).
concatenate date14(2) date16(2) date1+0(4) into result separated by '/'.
reward me if it helps.
Kinjal