When working with date and time objects in Java 8 you will probably need to add a time zone sooner or later. A time zone can be expressed as an offset from UTC (Coordinated Universal Time, or the time at the prime meridian running through Greenwich, England), a time zone ID (e.g., “America/New York”), or a time zone name (e.g., EST). In order to add a time zone you will need the ZonedDateTime, the ZoneOffset, or the ZoneId class. Each class is located in the java.time package. To understand how to add a time zone to a date/time object in Java 8, follow these four steps.

Leave a Reply

Your email address will not be published. Required fields are marked *