fork(6) 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.util.stream.* ;
  8.  
  9. /* Name of the class has to be "Main" only if the class is public. */
  10. class Ideone
  11. {
  12. public static void main (String[] args) throws java.lang.Exception
  13. {
  14. System.out.println( "Runtime.version(): " + Runtime.version() ) ; // In Java 9+.
  15.  
  16. Stream.of(
  17. "2010-01-01T12:00:00+01:00",
  18. "2010-01-01T12:00:00-01:00",
  19. "2010-01-01T12:00:00Z"
  20. )
  21. .map(Instant::parse)
  22. .map(Date::from)
  23. .forEach(System.out::println);
  24. }
  25. }
Success #stdin #stdout 0.25s 56884KB
stdin
Standard input is empty
stdout
Runtime.version(): 12.0.1+12
Fri Jan 01 11:00:00 GMT 2010
Fri Jan 01 13:00:00 GMT 2010
Fri Jan 01 12:00:00 GMT 2010