cancel
Showing results for 
Search instead for 
Did you mean: 

code to replace - by dots in date format

Former Member
0 Kudos

can anyone give me the java code for replacing - in the date by . pls....

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

U have a standard funtion in graphical mapping datetrans....using this u can change the date format into ur required format.

Regards,

Phani

deepak_shah
Contributor
0 Kudos

hi u can use the standard function to replace the - with . using DateTrans function under DATE function category.

Source format dd - MM - YYYY

Target format dd.MM.YYYY.

or the java code will be similar to this ..

this is not the exact code.. modify it to suit ur requirement.

public class test

{

public static void main(String[] args) {

String arg1= "1;11-11&999,34";

String arg2 = "";

for (int i = 0;i<arg1.length();i++)

{

int j = arg1.charAt(i);

if ((j<48 || j>57 ) && j!=44)

arg1 = arg1.replace(arg1.charAt(i),':');

else if(j==44)

arg2 = arg2.concat(String.valueOf(".").toString());

else

arg2 = arg2.concat(String.valueOf(arg1.charAt(i)).toString());

}

System.out.println(arg2);

}

}

Former Member
0 Kudos

Hello,

you can use the standard function

DateTrans

in message mapping.

In this function you can specify your source format.

For example:

MM-DD-YYYY

And your target format.

For example:

MM.DD.YYYY

Regards

Patrick