We would like to know how to get Europe/Berlin as now in Los Angeles.
import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; //from w w w.j av a 2s. com public class Main { public static void main(String[] args) { ZoneId berlin = ZoneId.of("Europe/Berlin"); // 2014-02-20 12:00 LocalDateTime dateTime = LocalDateTime.of(2014, 02, 20, 12, 0); // 2014-02-20 12:00, Europe/Berlin (+01:00) ZonedDateTime berlinDateTime = ZonedDateTime.of(dateTime, berlin); System.out.println(berlinDateTime); } }
The code above generates the following result.