cancel
Showing results for 
Search instead for 
Did you mean: 

convert date format dd-mm-yyyy to dd.mm.yyyy

Former Member
0 Kudos

hi,

Can anyone give the user defined fucntion code to change date format from dd-mm-yyyy to dd.mm.yyyy.

thanks and regards,

Nisheeta

Accepted Solutions (0)

Answers (3)

Answers (3)

Shabarish_Nair
Active Contributor
0 Kudos

<i>Can anyone give the user defined fucntion code to change date format from <b>dd-mm-yyyy to dd.mm.yyyy</b>.</i>

i think you dont need to use the date function

your scenario can be done via the text function replaceString )

give the date field as the first input, a constant with value - as the second input and a constant . as the third input.

Shabarish_Nair
Active Contributor
0 Kudos

use the standard date function available in the graphical mapping tool - DateTrans (http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm)

Former Member
0 Kudos

Hi,

you can use the dateTrans Standart function.

you don't need a user-function.

But if you still want to do it in a standart function look at the example source in my blog:

/people/robin.schroeder/blog/2006/11/21/dynamic-date-conversion-in-message-mapping


Date DateResult = new Date();

SimpleDateFormat dateSource = new SimpleDateFormat("dd-MM-yyyy");
SimpleDateFormat dateTarget = new SimpleDateFormat("dd.MM.yyyy");

try{
DateResult = dateSource.parse("30-11-2006"); <--- Here the incoming String value!!
}catch(Exception ex1){
}
String StringResult = dateTarget.format(DateResult);

result.addValue(StringResult);

Regards,

Robin

Former Member
0 Kudos

Hi Robin,

I actually checked on the fucntion datetrans, but it doesn't allow the seperator as '.' if i'm not mistaken. Or is there anyother way to get the seperator the way we desire.

regards,

Nisheeta

Former Member
0 Kudos

Hi,

you can just write <b>dd.MM.yyyy</b> in the dateTrans function target format field.

You don't have to use the given examples in the dropdown.

Regards,

Robin