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 =ZonedDateTime.now(); System.out.println(dateTime.getOffset()); } }
The code above generates the following result.