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

conver date format

Former Member
0 Likes
1,038

hi all,

how to convert the date format for ex.

i have date yyyymmdd but i want to change to ddmmyyyy . hw can possible.

regards.

amjad

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
957

U can either use the given fm by others or simply use a write statement.

WRITE ldate to lfdate ddmmyyyy.

ldate -> variable containing the date in yyyymmdd format

lfdate -> output with date in ddmmyyyy format.

Regards

Anurag

8 REPLIES 8
Read only

Former Member
0 Likes
957

Hi,

Use Function module Convert_date_format for this. This will work.

Read only

Former Member
0 Likes
957

Refer these threads:

Try searching the forum with 'date conversion' and you should get many more such examples.

Sudha

Read only

Former Member
0 Likes
957

Hi,

use the Function module <b>CONVERT_DATE_TO_EXTERNAL</b>

See the below link for more Date converstions:-

http://www.sap-basis-abap.com/sapab015.htm

Regards

Sudheer

Read only

shishupalreddy
Active Contributor
0 Likes
957

Hi ,

USE THE FOLLOWING CODE to convert the date into ur required format.

DATA : date1(10) value sy-datum.

data: l_f_date(10).

write date1 to l_f_date dd/mm/yyyy.

hope it will solve your problem .

regards,

Read only

Former Member
0 Likes
957

USE FOLLOWING EXAMPLE

data : ld_date(10) type c.

write irecord-datab to ld_date dd/mm/yyyy.

data : ld_date1(10) type c.

write irecord-datub to ld_date1 dd/mm/yyyy.

IT WILL WORK .

THANKS

Maheedhar.T

Read only

Former Member
0 Likes
957

Hello,

Do not use any function module or some "concatenate" statement. I guess you want to switch from system date format to european format (ddmmyyyy).

Date and amount format are defined in IMG for all country, then if a user wants a specific format, this is set up in his own user settings. Do not re-create what SAP already did.

If you want to determine format based on a country, process as below:

set country <country code>

write <my_variable_date> to <my_variable_string>

or

write:/001 <my_variable_date>

If you want to use user own settings then process as below:

write <my_variable_date> to <my_variable_string>

or

write:/001 <my_variable_date>

As you can see statement "set country <country code>" is used to get data from table t005x (where country code format are defined) otherwise if you don't use it, the "write" statement will use format that has been defined in t.code SU3 (user specific)

Let me know if you need additional informations,

Mehdi

Read only

Former Member
0 Likes
958

U can either use the given fm by others or simply use a write statement.

WRITE ldate to lfdate ddmmyyyy.

ldate -> variable containing the date in yyyymmdd format

lfdate -> output with date in ddmmyyyy format.

Regards

Anurag

Read only

Former Member
0 Likes
957

thx