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 function

Former Member
0 Likes
984

Hi All

I want to convet standard date 20061215 (yyyymmdd) into 15/12/2006 format, can any body help me with this.

kind regards

Anup

11 REPLIES 11
Read only

Former Member
0 Likes
956

Please check FM

CONVERSION_EXIT_PDATE_OUTPUT

CONVERSION_EXIT_SDATE_OUTPUT

This depends also on your user parameters

Goto SU01 - Change your Date Format to DD/MM/YYYY

One other way would be

WRITE ws_date to date. - This would convert it according to your user profile

Suppose you want to change under any conditions

and ws_date contains your date value.

DATE : date type char10

CONCATENATE ws_date6(2)ws_date4(2)ws_date+0(4)into date separated by '/'.

Read only

0 Likes
956

Hi

Plz try the following code

Data : lv_date_dest(12) ,

lv_date_src like sy-datum .

lv_date_src = sy-datum.

write 😕 lv_date_dest. " earlier date format

Concatenate lv_date_src6(2) '/' lv_date_src4(2) '/' lv_date_src(4)

into lv_date_dest. .

write 😕 lv_date_dest. " final date format

Regards

Pankaj

Read only

Former Member
0 Likes
956

Hi,

Use the command,

data:lws_date(10) type c.

WRITE sy-datum to lws_date dd/mm/yyyy.

Regards,

Read only

Former Member
0 Likes
956
REPORT YCHATEST LINE-SIZE 350.

DATA : V_DATE LIKE SY-DATUM.

V_DATE = SY-DATUM.

WRITE : V_DATE USING EDIT MASK '__/__/____'.
Read only

Former Member
0 Likes
956

Hi anupam,

1. we can use simple WRITE to variable

concept.

2. just copy paste.

report abc.

data : d1 type sy-datum value '20061215'.

data : s(10) type c.

write d1 to s.

replace all occurrences of '.' in s with '/'.

write 😕 s.

regards,

amit m.

Read only

Former Member
0 Likes
956

Hi,

Use the code as follows.I've used it in my program.

DATA: VDATE(10) TYPE C.

CONCATENATE sy-datum6(2) sy-datum4(2)

sy-datum+0(4) INTO VDATE

SEPARATED BY '/'.

Hope it helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
956

V1 = date+0(4).

V2 = date+4(2).

V3 = date+6(2).

Concatenate V3 V2 V1 into final_date separated by '/'.

Read only

anversha_s
Active Contributor
0 Likes
956

hi,

FM is

CONVERSION_EXIT_PDATE_OUTPUT

Conversion Exit for Domain GBDAT: YYYYMMDD -> DD/MM/YYYY

Regards

Anver

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
956

Please search before posting.

Read only

Former Member
0 Likes
956

Hi Anupam ... I think you dont have to use any FM for this problem..

This simple piece of code should solve your problem...

data : date type sy-datum.

data : date1(10) type c.

date = '20061215'.

write : date dd/mm/yyyy to date1.

write date1. " This displays ur date in the required format...

now date1 contains the the required date format in dd/mm/yyyy. ie . 15/12/2006

Please revert back in case of any issues...

Read only

0 Likes
956

Please look at the date of the original post before answereing again.

Rob