title: changing date to european style java
body: <p>I have a question on how to display the date into european style, like from 4/4/2013 to 4 - 4 - 2013. How can I fix this? Any help will be greatly appreciated. When I run my program I get this:</p>
  
  <pre><code>run:
  Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 47
  at java.lang.String.substring(String.java:1907)
  at Testing1.convertDate(Testing1.java:7)
  at Testing1.main(Testing1.java:14)
  Java Result: 1
  BUILD SUCCESSFUL (total time: 0 seconds)
  </code></pre>
  
  <p>Below is my code:</p>
  
  <p>Testing1.java:</p>
  
  <pre><code>public class Testing1{
  
  public static String convertDate(String amerDate){
      String month =  amerDate.substring(0, '/');
      String date =  amerDate.substring('/', '/');
      int year =  amerDate.indexOf("\4d");
      return date + " - " + month + " - " + year;
  }
  public static void main(String args[]){
      String date = "4/4/2013";
      date = convertDate(date);
      System.out.println(date);
  }
  }
  </code></pre>