Skip to Content
author's profile photo Former Member
Former Member

code to replace - by dots in date format

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 10:45 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 21, 2008 at 10:53 AM

    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);

    }

    }

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 10:53 AM

    Hi,

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

    Regards,

    Phani

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.