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.  
  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. ZoneId z = ZoneId.of( "Asia/Calcutta" ); // "Asia/Kolkata" "Asia/Calcutta"
  15. LocalTime lt = LocalTime.of( 5 , 34 , 12 );
  16.  
  17. ZonedDateTime zdt1943 = ZonedDateTime.of( LocalDate.of( 1943 , Month.APRIL , 12 ) , lt , z );
  18. ZonedDateTime zdt1945 = ZonedDateTime.of( LocalDate.of( 1945 , Month.APRIL , 12 ) , lt , z );
  19. ZonedDateTime zdt1946 = ZonedDateTime.of( LocalDate.of( 1946 , Month.APRIL , 12 ) , lt , z );
  20. ZonedDateTime zdt2016 = ZonedDateTime.of( LocalDate.of( 2016 , Month.APRIL , 12 ) , lt , z );
  21.  
  22. System.out.println( "zdt1943: " + zdt1943 );
  23. System.out.println( "zdt1945: " + zdt1945 );
  24. System.out.println( "zdt1946: " + zdt1946 );
  25. System.out.println( "zdt2016: " + zdt2016 );
  26. }
  27. }
Success #stdin #stdout 0.09s 711680KB
stdin
Standard input is empty
stdout
zdt1943: 1943-04-12T05:34:12+06:30[Asia/Calcutta]
zdt1945: 1945-04-12T05:34:12+06:30[Asia/Calcutta]
zdt1946: 1946-04-12T05:34:12+05:30[Asia/Calcutta]
zdt2016: 2016-04-12T05:34:12+05:30[Asia/Calcutta]