title: Instant.now equivalent to java.util.Date or Java 7
body: <p>I have a system using Java 7 and I need to generate a date equivalente to <code>Instant.now</code> (Java 8).</p>
  
  <p>For example, <code>Instant.now().toString()</code> generate a date like that:
  <strong>"2018-12-19T12:32:46.816Z"</strong></p>
  
  <p>Using <code>java.util.Date</code> I have this date: <strong>"2018-12-19T10:38:13.892"</strong></p>
  
  <pre><code>    Date date = new Date(System.currentTimeMillis());
      SimpleDateFormat sdf;
      sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
      String text = sdf.format(date);
      System.out.println(text);
  </code></pre>
  
  <p>I don't know if I can simply concatenate a <strong>"Z"</strong> at the end of this date.</p>
  
  <p>Without <strong>"Z"</strong> another system that parse this date using <code>Instant.parse</code> throws the error:</p>
  
  <blockquote>
    <p>java.time.format.DateTimeParseException: Text
    '2018-12-19T10:38:13.892' could not be parsed at index 23
            at java.base/java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1988)
            at java.base/java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1890)
            at java.base/java.time.Instant.parse(Instant.java:395)</p>
  </blockquote>