title: SimpledateFormat's parse method java
body: <p>This is a silly question, but I can't see what I am doing wrong. I want to parse a string like <code>24:00</code> to a date object. I am aware that if we use <code>kk:mm</code> as the date format the times would be from 01:00 to 24:00 (<a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html" rel="nofollow">from the API</a>). But I can't get the below code working. </p>
  
  <pre><code>String test = "24:00";
  System.out.println("TEST: " + new SimpleDateFormat("kk:mm").parse(test));
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>TEST: Thu Jan 01 00:00:00 GMT 1970
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>TEST: Thu Jan 01 24:00:00 GMT 1970
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <pre><code>System.out.println("TEST: " + new SimpleDateFormat("k:mm:ss").format(new SimpleDateFormat("k:mm:ss").parse(test)));
  </code></pre>
  
  <p>this prints <code>TEST: Thu Jan 01 24:00:00 GMT 1970</code></p>
  
  <p>But why not while parsing?</p>
  
  <p>Any help is greatly appreciated</p>