Java Data Type How to - Parse 2014-02-20T20:21:20.432Z to create Instant








Question

We would like to know how to parse 2014-02-20T20:21:20.432Z to create Instant.

Answer

import java.time.Instant;

public class Main {

  public static void main(String[] args) {
    System.out.println(Instant.parse("2014-02-20T20:21:20.432Z"));
  }
}

The code above generates the following result.