title: Convert UTC string date to date format
body: <p>How to convert string &quot;2020-09-02T12:22:53.9&quot; to date format 2020-09-02T12:22:53.9 in java?</p>
  <pre><code>String dateString = &quot;2020-09-02T12:22:53.9&quot;;
  String tz = &quot;America/Mexico_City&quot;;
  DateTimeFormatter dtf = DateTimeFormatter.ofPattern(&quot;yyyy-dd-mm hh:mm:ss.S&quot;);
  ZoneId zoneId = ZoneId.of(tz);
  Instant instant = Instant.parse(dateString);
  ZonedDateTime dateTimeInTz =ZonedDateTime.ofInstant(instant, zoneId);
  System.out.println(dateTimeInTz.format(dtf));
  </code></pre>
  <p>This code throws a <code>java.time.format.DateTimeParseException: Text '2020-09-02T12:22:53.9' could not be parsed at index 21</code> form the line <code>Instant instant = Instant.parse(dateString);</code>.</p>