parsing date/time to localtimezone

String timeToConvert = “2018-06-25T08:06:52Z”; Instant inst = Instant.parse(timeToConvert); LocalTime time = inst.atZone(ZoneId.of(“Africa/Nairobi”)) .toLocalTime() .truncatedTo(ChronoUnit.MINUTES); System.out.println(“Time in Nairobi: ” + time); This prints: Time in Nairobi: 11:06 I am using java.time, in this case the backport to Java 6 and 7. This backport is available in an Android edition too, which you may use for low … Read more

How can I catch Event Dispatch Thread (EDT) exceptions?

The EDT exception handler doesn’t use Thread.UncaughtExceptionHandler. Instead, it calls a method with the following signature: public void handle(Throwable thrown); Add that to MyExceptionHandler, and it should work. The “documentation” for this is found in EventDispatchThread, which is a package-private class in java.awt. Quoting from the javadoc for handleException() there: /** * Handles an exception … Read more