From this time :
String date = "2023-01-31T23:00:00.000Z";
Which is in zulu time (UTC). How can I get the LocalDateTime
in Paris time ? which can be UTC+1 or UTC+2 depending on the offeset if it's Summer or Winter.
I tried that but it doses not work :
String date = "2023-01-31T23:00:00.000Z";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").withZone(ZoneOffset.UTC);
LocalDateTime datetime = LocalDateTime.parse(date, formatter);
System.out.println(datetime);
System.out.println(datetime.atZone(ZoneId.of("Europe/Paris")));
The output :
2023-01-31T23:00
2023-01-31T23:00+01:00[Europe/Paris]