fork(2) 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.text.SimpleDateFormat;
  7.  
  8. /* Name of the class has to be "Main" only if the class is public. */
  9. class Ideone
  10. {
  11. public static void main (String[] args) throws java.lang.Exception
  12. {
  13. String s = "2015-08-20T08:26:21.000Z";
  14. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSX");
  15. Date d = df.parse(s);
  16. System.out.println("d = " + d);
  17. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
  18. sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
  19. System.out.println(sdf.format(d));
  20. }
  21. }
Success #stdin #stdout 0.14s 321472KB
stdin
Standard input is empty
stdout
d = Thu Aug 20 08:26:21 GMT 2015
2015-08-20T08:26:21Z