OffsetTime getOffset()
gets the zone offset,
such as '+01:00'.
This is the offset of the local time from UTC/Greenwich.
getOffset
has the following syntax.
public ZoneOffset getOffset()
The following example shows how to use getOffset
.
import java.time.OffsetTime; import java.time.ZoneOffset; //www .j a v a 2s .c o m public class Main { public static void main(String[] args) { OffsetTime m = OffsetTime.now(); ZoneOffset z = m.getOffset(); System.out.println(z); } }
The code above generates the following result.