‎2007 Jun 04 11:18 PM
Hi Experts,
Is there a FM to convert a Date from format YYYYMMDD to MM/DD/YYYY.
For eg: I wanna see 20070604 as 06/04/2007. Please advise.
Thanks a lot for your help.
‎2007 Jun 04 11:22 PM
No need to use function module.
data date_char(10).
write sy-datum to date_char.
DATE_CHAR will have value in mm/dd/yyyy.
And if you wanna display the date then directly:
write sy-datum.
The date displayed in output will be in mm/dd/yyyy format.
In your example:
data date_char(10).
data date_date type d.
date_date = '20070604'.
write date_date to date_char.
date_char will have value '06/04/2007'.
‎2007 Jun 04 11:22 PM
No need to use function module.
data date_char(10).
write sy-datum to date_char.
DATE_CHAR will have value in mm/dd/yyyy.
And if you wanna display the date then directly:
write sy-datum.
The date displayed in output will be in mm/dd/yyyy format.
In your example:
data date_char(10).
data date_date type d.
date_date = '20070604'.
write date_date to date_char.
date_char will have value '06/04/2007'.
‎2007 Jun 04 11:27 PM
Great! Thanks for the help. But I have two dates to display in the output. How can I do that in this case?
Thanks.
‎2007 Jun 04 11:27 PM
data : v_date(10) type c,
v_day(2) type c,
v_mon(2) type c,
v_year(4) type c.
data v_mdate(8) type c.
start-of-selection.
v_mdate = sy-datum.
v_year = v_mdate+0(4).
v_mon = v_mdate+4(2).
v_day = v_mdate+6(2).
concatenate v_mon '/' v_day '/' v_year into v_date.
write v_date.
‎2007 Jun 04 11:32 PM