[Solved] Java Date and utcTimeOffset [closed]
java.time, the modern Java date and time API ZoneId danishTime = ZoneId.of(“Europe/Copenhagen”); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(“uuuuMMddHHmmss”); DateTimeFormatter offsetFormatter = DateTimeFormatter.ofPattern(“XX”); String dateTimeString = “20180730131847”; String offsetString = “+0200”; ZoneOffset offset = ZoneOffset.from(offsetFormatter.parse(offsetString)); ZonedDateTime dateTime = LocalDateTime.parse(dateTimeString, dateTimeFormatter) .atOffset(offset) .atZoneSameInstant(danishTime); System.out.println(“Danish time: ” + dateTime); Output from this code is: Danish time: 2018-07-30T13:18:47+02:00[Europe/Copenhagen] The time zone … Read more