cancel
Showing results for 
Search instead for 
Did you mean: 

function module to convert date format from yyyymmdd to mmddyyyy format

Former Member
0 Kudos

function module to convert date format from yyyymmdd to mmddyyyy format

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rajitha,

Do like this

Data: Var1 type sy-datum,
         var2(8) type c.

var1 = sy-datum.

Concatanate var1+4(2) var1+6(2) var1+0(4) into var2.

write var2.

Reward Points if this helps,

Satish

Former Member
0 Kudos

thanks a lot satish

ralf_wenzel_heuristika
Active Participant
0 Kudos


Satish Panakala wrote:

Hi Rajitha,

Do like this

Data: Var1 type sy-datum,
         var2(8) type c.

var1 = sy-datum.

Concatanate var1+4(2) var1+6(2) var1+0(4) into var2.

write var2.

Reward Points if this helps,

Satish

OMG, this solution is SO wrong. Date formatting depends on the country, the calendar and the user's preferences! THIS only works for a few countries in the world! I can't believe, that Satish gots reward points for this bad solution.....

CONVERT_DATE_TO_EXTERNAL works better, which you can see after setting your date formatting preferences in your User Settings!

matt
Active Contributor
0 Kudos

I've fixed that now.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use FM CONVERT_DATE_TO_INTERNAL

Reward if helpful.

Regards,

Harini.S

Former Member
0 Kudos

HI,

Just try the following syntax,

write a MMDDYYYY.

where,

a- variable containing the date.