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

Format date-- URGENT

Former Member
0 Likes
1,732

Hi all,

I need to format the date as follows:

input date format : 20070506 (system date format )

required output date format : 05.06.2007

I tried with the FMs CONVERSION_EXIT_SDATE_OUTPUT,CONVERSION_EXIT_LDATE_OUTPUT

I get the output as 05.May.2007. This is not what is needed.

Please let me know how to I get the reqd date format VERY URGENT

Thanks & Regards,

Srilakshmi B

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,673

Hi

Input date format : 20070506 (system date format )

Required output date format : 05.06.2007

DATA : DAT1 TYPE DATS VALUE '20070506,

DAT2 TYPE STRING.

U can use CONCATENATE DAT14(2) '.' DAT16(2) '.' DAT1+0(4) TO DAT2.

Regards,

Mayank

Hi all,

I need to format the date as follows:

input date format : 20070506 (system date format )

required output date format : 05.06.2007

I tried with the FMs CONVERSION_EXIT_SDATE_OUTPUT,CONVERSION_EXIT_LDATE_OUTPUT

I get the output as 05.May.2007. This is not what is needed.

Please let me know how to I get the reqd date format VERY URGENT

Thanks & Regards,

Srilakshmi B

14 REPLIES 14
Read only

Former Member
0 Likes
1,673

Hi Srilakshmi,

Just split that date and insert into 3 workareas and display.

Regards,

dvns

Read only

Former Member
0 Likes
1,673

CONVERT_DATE_TO_EXTERNAL , try this FM

Thanks

Swarna

Read only

Former Member
0 Likes
1,673

Use the Function Module CONVERT_DATE_TO_EXTERNAL to convert the date to the external format.

Read only

Former Member
0 Likes
1,673

data: l_dat(10).

concatenate sy-datum+6(2)

'.'

sy-datum+4(2)

'.'

sy-datum+0(4) into l_dat.

Read only

Former Member
0 Likes
1,673

Hi,.

you can use offset opperator, like this

data: v_datum(10) type c.

concatenate sy-datum+4(2) '.' sy-datum +2(2) '.' sy-datum +0(4) to v_datum.

write:/ v_datum.

Regards,

S.Nehru

Read only

Former Member
0 Likes
1,673

Hi,

Use FM CONVERT_DATE_TO_EXTERNAL or

CONVERT_DATE_TO_INTERNAL

Read only

Former Member
0 Likes
1,674

Hi

Input date format : 20070506 (system date format )

Required output date format : 05.06.2007

DATA : DAT1 TYPE DATS VALUE '20070506,

DAT2 TYPE STRING.

U can use CONCATENATE DAT14(2) '.' DAT16(2) '.' DAT1+0(4) TO DAT2.

Regards,

Mayank

Read only

Former Member
0 Likes
1,673

Thanks all for the response..will award points

I used a FM. It gives a output 06052007.

All i need to do now is put a '.' to get 06.05.2007.

Is this possible ?

Read only

0 Likes
1,673

Hi,

U Can use CONCATENATE keyword to achieve the same.

Just manipulate my previous post a little bit.

Regards,

Mayank

Read only

0 Likes
1,673

Hi,

Have a look on the following code u can get the solution.

DATA: VAR1 TYPE SY-DATUM value '20080313',

VAR2 TYPE SY-DATUM.

  • This gives the previous month and next month

CALL FUNCTION 'HR_PT_ADD_MONTH_TO_DATE'

EXPORTING

dmm_datin = var1

dmm_count = '0'

dmm_oper = '-' " Operation (add/subtract)

dmm_pos = 'B' " Set date in the beginning or end of month

IMPORTING

DMM_DAOUT = VAR2

EXCEPTIONS

UNKNOWN = 1

OTHERS = 2.

write:/ var2.

This function module is used to get the previous month/next month.

Regards,

Chandu.

Read only

0 Likes
1,673

hey you can directly use this date format without any '.' in your transaction. Otherwise use offset operator by concatenating each variable with '.'

Reward points if use full.

Thanks,

Swapna

Read only

Former Member
0 Likes
1,673

hi....

DATA: yyyy TYPE string.

DATA: mm TYPE string.

DATA: dd TYPE string.

LOOP AT date.

dd = date-eindt+6(2).

mm = date-eindt+4(2).

yyyy = date-eindt+2(4).

CONCATENATE dd mm yyyy INTO date-date1 ."SEPARATED BY '.' .

modify date .

ENDLOOP.

DELETE ADJACENT DUPLICATES FROM date.

Read only

SantoshKallem
Active Contributor
0 Likes
1,673

yes it is possible.

create one vatiable to hold the date with saperaters, size should be 10

data: date1(10) type c.

write: sy-datum to date1 using edit mask '__.__.____'.

regards.

santhosh reddy

Edited by: Santhosh Reddy on Mar 13, 2008 11:50 AM

Read only

Former Member
0 Likes
1,673

simple solution

write:/ sy-datum using edit mask '__.__.____'.