fork download
  1. import java.time.ZoneId;
  2. import java.time.ZoneOffset;
  3. import java.time.ZonedDateTime;
  4. import java.util.TimeZone;
  5. import java.util.Date;
  6.  
  7. public class Main {
  8. public static void main(String[] args) {
  9. ZoneOffset offset = ZonedDateTime.now(ZoneId.of("America/New_York")).getOffset();
  10. System.out.println(offset);
  11. System.out.println(TimeZone.getDefault().getOffset((new Date()).getTime()));
  12. }
  13. }
Success #stdin #stdout 0.15s 62388KB
stdin
Standard input is empty
stdout
-05:00
0