Java Tutorials
OffsetDateTime represents ,
now()
method returns system's date.of
method returns specific date of your choice. Both are static methods.In this case you should know the offset value of perticular city
Creating a America/New_York time using offset value -5:00 LocalDateTime ldt = LocalDateTime.now(); OffsetDateTime odt = ldt.atOffset(ZoneOffset.ofHours(-5)) System.out.println(odt); 2023-01-25T21:57:14.750721-05:00
ADS