title: Kotlin/java - How to convert a date time string to Instant?
body: <p>I am trying to create an instance of Instant from date and time strings. Date is formatted like this <code>yyyy-MM-dd</code>. So the values could look like this:</p>
  <pre><code>val date = &quot;2021-11-25&quot;
  val time = &quot;15:20&quot;
  </code></pre>
  <p>I am trying to make a valid instant from this 2 strings like this:</p>
  <pre><code>val dateTime = &quot;${date}T${time}:00&quot;
  val instantDateTime = ZonedDateTime.parse(dateTime, 
                                            DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(defaultTimeZone)
                                           ).toInstant()
  </code></pre>
  <p>I have also tried with it:</p>
  <pre><code>val instantDateTime = Instant.from(DateTimeFormatter .ISO_OFFSET_DATE_TIME.withZone(defaultTimeZone).parse(dateTime))
  </code></pre>
  <p>But, that is not working, I get:</p>
  <pre><code>Exception in thread &quot;main&quot; java.time.format.DateTimeParseException: Text '2021-11-25T15:20:00' could not be parsed at index 19
  </code></pre>