fork 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.zone.* ;
  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. Instant instant = Instant.ofEpochMilli( 1_715_244_851_730L ) ;
  15. ZoneId z = ZoneId.of( "Asia/Tehran" ) ;
  16. ZonedDateTime zdt = instant.atZone( z ) ;
  17.  
  18. ZoneRules rules = z.getRules() ;
  19. boolean isDst = rules.isDaylightSavings( instant ) ; // Returns WRONG result; should be `false`. Ideone.com uses outdated Java 12 with an outdated copy of tzdata zone rules file.
  20.  
  21. System.out.println( instant.toString() ) ;
  22. System.out.println( zdt.toString() ) ;
  23. System.out.println( isDst ) ;
  24. }
  25. }
Success #stdin #stdout 0.12s 59344KB
stdin
Standard input is empty
stdout
2024-05-09T08:54:11.730Z
2024-05-09T13:24:11.730+04:30[Asia/Tehran]
true