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 format

Former Member
0 Likes
772

Hi guys,

i am working on one report in which i am getting date from the selection screen.

i defined

parameters: p_datum like sy-datum.

i am getting it in the format YYYYMMDD.

now i want to convert it to MMDDYYYY.

the problem is i am looking for any function module which will convert date from YYYYMMDD to MMDDYYYY.

i tried CONVERT_DATE_TO_INTERNAL and CONVERT_DATE_TO_external .

but nothing is working for MMDDYYYY formt .

the second problem is i am using this program for different country and all have different format of date so i want one way which will convert date for any country.

Thanks,

Jack

5 REPLIES 5
Read only

Former Member
0 Likes
663

Hi Jack,

do like this

date = sy-datum.

Concatenate date4(2) date6(2) date+0(4) into new_date.

Reward if this helps,

Satish

Read only

naimesh_patel
Active Contributor
0 Likes
663

You can do it also..

data: l_char(8) type c.

write: l_date to l_char  MMDDYYYY.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
663

Hi,

try this,

parameters: p_datum like sy-datum.

write : p_datum MMDDYYYY.

For more date formats look at this link,

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/write_op.htm

Read only

Former Member
0 Likes
663

Hi JACK,

Why it is not working <b>?</b>... it should work ...

try to pass accurate parameters in FMs...

use below Function modules to solve ur problem...

<b>CONVERT_DATE_TO_EXTERNAL</b>

<b>CONVERSION_EXIT_PDATE_OUTPUT</b>



data: lv_date type sydatum,
e_calc_date type sydatum.

lv_date = sy-datum.
lv_year = lv_date(4).
lv_month = lv_date+4(2).
lv_day = lv_date+6(2).

concatenate lv_month lv_day lv_year into E_CALC_DATE.

Hope it will solve ur problem..

<b>Reward points if useful</b>

Thanks & Regards

ilesh 24x7

Read only

Former Member
0 Likes
663

Hi

PDOT_DATE_CONVERT