0

How can I set the ZoneId.of("GMT+2") for all further instances of LocalDateTime in a spring app?

currently i'm using this: LocalDateTime.now(ZoneId.of("GMT+2"))

thanks

Padi
  • 711
  • 9
  • 18
  • 1
    doesn't (setting) the default `TimeZone` work for you? – user16320675 Jan 31 '22 at 11:42
  • `LocalDateTime` has no concept of time zone. You are using the wrong class. Use `ZonedDateTime` instead. Pass the desired/expected time zone rather than relying on the JVM’s current default zone. `ZonedDateTime.now( ZoneId.of( "Europe/Bucharest" ) )` – Basil Bourque Jan 31 '22 at 14:07

0 Answers0