fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.time.*;
  8. import java.time.temporal.*;
  9. import java.time.format.*;
  10.  
  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.  
  18. long input = 1_360_753_217_219L ;
  19. Instant instant = Instant.ofEpochMilli( input ) ;
  20.  
  21. ZoneId zEurope_Istanbul = ZoneId.of( "Europe/Istanbul" ) ;
  22. ZonedDateTime zdtEurope_Istanbul = instant.atZone( zEurope_Istanbul ) ;
  23.  
  24. ZoneId zAmerica_Caracas = ZoneId.of( "America/Caracas" ) ;
  25. ZonedDateTime zdtAmerica_Caracas = zdtEurope_Istanbul.withZoneSameInstant( zAmerica_Caracas ) ;
  26.  
  27. System.out.println( "instant.toString(): " + instant ) ;
  28. System.out.println( "zdtEurope_Istanbul.toString(): " + zdtEurope_Istanbul ) ;
  29. System.out.println( "zdtAmerica_Caracas.toString(): " + zdtAmerica_Caracas ) ;
  30.  
  31. }
  32. }
Success #stdin #stdout 0.16s 4386816KB
stdin
Standard input is empty
stdout
instant.toString(): 2013-02-13T11:00:17.219Z
zdtEurope_Istanbul.toString(): 2013-02-13T13:00:17.219+02:00[Europe/Istanbul]
zdtAmerica_Caracas.toString(): 2013-02-13T06:30:17.219-04:30[America/Caracas]