I have this line of code:
// I pass milliseconds timestamp on time var
ZonedDateTime zonedDatetIme = ZonedDateTime.ofInstant(java.time.Instant.ofEpochMilli(time), java.time.ZoneId.of("Asia/Almaty"))
When I try to output this time, it returns this:
System.our.println(zonedDatetIme)
// returns
2020-01-24T17:00+06:00[Asia/Almaty]
Then I'm trying to format this datetime:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern('dd.MM.yyyy hh:mm');
System.our.println(formatter.format(zonedDateTime));
Which returns to me this:
24.01.2020 05:00
That is wrong. It is like it substracting 6 hours of my timezone instead of adding it. Why this is happening?