我有偏移值像UTC + 3我想在java中缩写它
答案 0 :(得分:1)
this的改编可能有用。
Set<String> allZones = ZoneId.getAvailableZoneIds();
LocalDateTime dt = LocalDateTime.now();
List<String> zoneList = new ArrayList<>(allZones);
Collections.sort(zoneList);
zoneList.stream().map((s) -> ZoneId.of(s)).forEach((zone) -> {
ZonedDateTime zdt = dt.atZone(zone);
ZoneOffset offset = zdt.getOffset();
String out = String.format("%35s %10s%n", zone, offset);
if (offset.getTotalSeconds() == 10800) {
System.out.printf(out);
}
});