title: how to change date format in java?
body: <p>i am getting my date input as a string in the format <code>dd-mm-yy</code> through jsp page. Because this format is better to understand . But now i want to store the date in <code>yyyy-MM-dd HH:mm:ss</code> format in my database. I am using the following code.</p>
  
  <pre><code>try
      {       
      String s="30-04-2013";
      SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      d1=new SimpleDateFormat("yyyy-MM-dd").parse(s);
      System.out.println(d1);
      System.out.println(ft.format(d1));
      } catch(Exception e) {
          System.out.println("Exception:"+e);
      }
  </code></pre>
  
  <p>My Jsp date format is <code>dd-mm-yy</code>, but it gives answer as</p>
  
  <pre><code>Tue Oct 04 00:00:00 IST 35
  0035-10-04 00:00:00
  </code></pre>
  
  <p>what is my mistake?
  can tell me anyone please</p>
  
  <p>Thank you.</p>