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

Converting date format

Former Member
0 Likes
1,129

Hi folks,

Pls tell me the function module which converts date format from 20080704 to 04.07.2008. I have done it by offet operations. But i want to do it by FM. pls help me..

Thanks.

Shyam.

9 REPLIES 9
Read only

Former Member
0 Likes
1,102

Hi

Use this FM CONVERT_DATE_TO_INTERN_FORMAT

Reward if helpful.

Regards

Chandralekha.

Read only

Former Member
0 Likes
1,102

Hi,

Use the function module

'CONVERT_DATE_TO_INTERN_FORMAT'

Hope it is usefull...

Jaya Vani

Read only

Former Member
0 Likes
1,102

Hi,

If you are looking for printing the date based on user format

WRITE sy-datum TO date_short would help,

or else you can try

WRITE sy-datum TO date_long,

date_mask DD/MM/YY.

Read only

Former Member
0 Likes
1,102

Check out FM's

CONVERT_DATE_TO_INTERNAL or CONVERT_DATE_TO_EXTERNAL.

Regards,

Santosh

Read only

Former Member
0 Likes
1,102

Hi

U don't need any fm but only WRITE statament:

WRITE <DATE IN> TO <DATE OUT> .

Max

Read only

Former Member
0 Likes
1,102

Hi

you can also ues this CONVERT_DATE_INPUT

Reward if helpful.

Regards

Chandralekha.

Read only

Former Member
0 Likes
1,102

hi jusu try this,

data: dt(8) type c,

dt = sy-datum

dt will contain 04.07.2008

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,102

Hi Syam,

I assume ur date is like this 2008-year, 07-month 04-date.

If u always want ur date in DD.MM.YYYY then use concatenate statement.

DATA: w_date TYPE sy-datum VALUE '20080704',

w_date1(10) TYPE c.

CONCATENATE w_date6(2) w_date4(2) w_date+0(4) INTO w_date1 SEPARATED BY '.'.

If u want the date as per user settings then even no need of FM. U can simply use WRITE TO statement.

WRITE w_date TO w_date1.

This will write the date as per user settings.

eg: If user setting is MM-DD-YYYY.

Then above statement will write 07-04-2008 to w_date1.

Check SU3 transaction=>Defaults tab for user settings. U can try above thing by changing ur settings.

Note: Settings will be effective from next log on onwards.

Thanks,

Vinod.

Read only

former_member787646
Contributor
0 Likes
1,102

Hi,

Try the FM "CONVERT_DATE_TO_EXTERNAL" and check.

Hope it helps you.

Murthy.