title: How to print the current time and date in ISO date format in java?
body: <p>I am supposed to send the current date and time in ISO format as given below:</p>
  
  <p><strong>'2018-02-09T13:30:00.000-05:00'</strong></p>
  
  <p>I have written the following code:</p>
  
  <pre><code>Date date = new Date();
  SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
  SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.000'Z'");
  System.out.println(formatter.format(date));
  System.out.println(formatter1.format(date));
  </code></pre>
  
  <p>It prints in the following way:</p>
  
  <pre><code>2018-04-30T12:02
  2018-04-30T12:02:58.000Z
  </code></pre>
  
  <p>But it is not printing as the format mentioned above. How can I get the -5:00 as shown in the format and what does it indicate?</p>