Java Date Time - ZonedDateTime getOffset() example

ZonedDateTime getOffset() gets the zone offset, such as '+01:00'. This is the offset of the local date-time from UTC/Greenwich.


getOffset has the following syntax.

public ZoneOffset getOffset()


The following example shows how to use getOffset.

import java.time.ZonedDateTime;

public class Main {
  public static void main(String[] args) {
    ZonedDateTime dateTime;


The code above generates the following result.