When my system time zone area and stored in a database located in the eastern (American / New York). I'm using an object using the date class. I have a piece of code will resolve it to ZonedDateTime, then convert it to a user's time zone display. For example :( USA / New York) -> (United States / Los Angeles).
Now, I want this date, in the converted American / Los Angeles, back to the (American / New York). For example :( United States / Los Angeles) -> (USA / New York). Please note that the date and time are now stored in a date object, and my system time is the US / New York.
How to create ZonedDateTime in the United States / Los Angeles area, without the need to convert the system time?
I think the system of Dating in the United States / New York, and then change the time.
I try to use real-time, string, and so as to create ZonedDateTime United States / Los Angeles. But once every test, JVM will convert my date to Los Angeles, and changing the time 3 hours.
ZonedDateTime result = ZonedDateTime.of( LocalDateTime.of(LocalDate.of(...), LocalTime.of(...)), ZoneId.of("NY") );