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

Function module for date format conversion

Former Member
0 Likes
4,385

hi ,

Can someone plzz tell me if there is a SAP standard function module that can convert date of any format to date of a particular format .

Thanks

Sheetal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,586

hI Sheetal Hirde ,

Try this :

data : v_date like sy-datum.

write : v_date using edit mask '__/__/____'

call function 'CONVERT_DATE_TO_INTERNAL'

Thanks

Vikranth

Message was edited by:

Khimavath Vikranth

8 REPLIES 8
Read only

Former Member
0 Likes
1,586

no need to use fm just use 'WRITE TO ........... WITH EDIT MASK'

Sameer

Read only

Former Member
0 Likes
1,587

hI Sheetal Hirde ,

Try this :

data : v_date like sy-datum.

write : v_date using edit mask '__/__/____'

call function 'CONVERT_DATE_TO_INTERNAL'

Thanks

Vikranth

Message was edited by:

Khimavath Vikranth

Read only

0 Likes
1,586

hi Vikranth ,

I want to convert YYYY/MM/DD to DD/MM/YYYY.

please advice

Read only

0 Likes
1,586

Hi Sheetal,

You have to do settings in SU3(T.CODE). In SU3 goto defaults there you find Date Format. try to keep your settings and save it. This will work.

award points if it is useful

Thanks

Vikranth Khimavath

Read only

Former Member
0 Likes
1,586

use the fallowing fm DATE_CONV_EXT_TO_INT and

CONVERT_DATE_TO_EXTERNAL

Read only

Former Member
0 Likes
1,586

REPORT ZTRIP_TEST .

data:

external_date(10),

sap_date like sy-datum.

external_date = '2006.12.01'.

CALL FUNCTION 'KCD_EXCEL_DATE_CONVERT'

EXPORTING

EXCEL_DATE = external_date

DATE_FORMAT = 'JMT' "(T) Day,(M) Month,(J) Year

IMPORTING

SAP_DATE = sap_date

.

write:/ sap_date.

Message was edited by:

Tripat Pal Singh

Read only

0 Likes
1,586

hey

Thanks a lot

Read only

Former Member
0 Likes
1,586

Hi,

Data: V_date(10) type c.

v_date = 'yyyy/mm/dd'. " your format.

write : v_date using edit mask '__/__/____' " this will conver the format

If you want the user specfic format, then use the below code

Data: Date1 type Sy-datym,

Date2(10) type c.

date1 = Sy-datum

Write: Date1 to Date2.

Write:/ Date2. " This Date2 will have the user Specif format

Regards

Sudheer