I am trying to retrieve UTC time HH:MM:SS using DateFormatter. I can't seem to find a simple example. Ideally, I'd like to do something like:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH,mm,ss").withLocale(TimeZone.getTimeZone("UTC"));
but this code doesn't work. Can someone help me find an easy way to do this?
Didn't know about zoneIds. It can be done with this:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH,mm,ss").withZone(ZoneId.of("UTC"));