title: 24 hour in SimpleDateFormat() and milliseconds in java
body: <p>I am building a DAQ software and right now I am in the process of creating a log file. I thought of showing the time on each entry. A simple code(that cannot compile) is the following</p>
  
  <pre><code>import java.util.Date;
  import java.text.DateFormat;
  import java.text.SimpleDateFormat;
  import java.util.Calendar;
  
  public class daq(){
  
      SimpleDateFormat now = new SimpleDateFormat("hh:mm:ss");
  
      public void go(){
          report.setProperty("INSERT", "["+now.format(new Date())+"] Acquisition Started\n");
      }
      public void init(){
          report.setProperty("INSERT", "["+now.format(new Date())+"] ADC Channel 1: Read Complete\n");
          report.setProperty("INSERT", "["+now.format(new Date())+"] Initialisation Complete\n");
      }
      public void stop(){
          report.setProperty("INSERT", "["+now.format(new Date())+"] Acquisition Stopped\n");
      }
  
  }
  </code></pre>
  
  <p>A typical result of the above "code" is the following</p>
  
  <pre><code>[06:30:09] Acquisition Started
  [06:30:09] ADC Channel 1: Read Complete
  [06:30:09] Initialisation Complete
  [06:30:13] Acquisition Stopped
  </code></pre>
  
  <p>I was wondering if there is a way to display the time in 24 hour format(i.e. <code>18:30:09</code> instead of <code>06:30:09</code>)?</p>
  
  <p>Is there also a way to display milliseconds? A format like <code>hh:mm:ss:mils</code>? I tried to use <code>sss</code> instead of <code>ss</code> but I only get a <code>0</code> for the first <code>s</code>. An example output is</p>
  
  <pre><code>[21:50:004] Acquisition Started
  [21:50:004] ADC Channel 1: Read Complete
  [21:50:004] Initialisation Complete
  [21:50:013] Acquisition Stopped
  </code></pre>