fork(7) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.time.*;
  7. import java.time.format.*;
  8.  
  9. class Ideone{
  10. public static void main (String[] args) throws java.lang.Exception{
  11. String str = "2018-01-02T18:14:59.000+01:00";
  12. Instant instant = DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse(str, Instant::from);
  13. System.out.println(instant);
  14. }
  15. }
Success #stdin #stdout 0.24s 34728KB
stdin
Standard input is empty
stdout
2018-01-02T17:14:59Z