fork(1) 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.LocalDateTime;
  8. import java.time.ZoneId;
  9. import java.time.ZonedDateTime;
  10. import java.time.format.DateTimeFormatter;
  11.  
  12. /* Name of the class has to be "Main" only if the class is public. */
  13. class Ideone
  14. {
  15. public static void main (String[] args) throws java.lang.Exception
  16. {
  17. ZonedDateTime timeAsUTC1 = LocalDateTime.from(DateTimeFormatter.ofPattern("yyyyMMddHHmmss-SSS").parse("20190902165550-091")).atZone(ZoneId.of("UTC"));
  18. System.out.println(timeAsUTC1);
  19.  
  20. ZonedDateTime timeAsUTC2 = LocalDateTime.from(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").parse("20190902165550091")).atZone(ZoneId.of("UTC"));
  21. System.out.println(timeAsUTC2);
  22. }
  23. }
Success #stdin #stdout 0.12s 34924KB
stdin
Standard input is empty
stdout
2019-09-02T16:55:50.091Z[UTC]
2019-09-02T16:55:50.091Z[UTC]