Java Date Time Java Java API
java.time.OffsetTime
public ZoneOffset getOffset()
Returns a corresponding ZoneOffset instance.
package com.logicbig.example.offsettime;import java.time.OffsetTime;import java.time.ZoneOffset;public class GetOffsetExample { public static void main(String... args) { OffsetTime d = OffsetTime.of(17, 40, 33, 20000, ZoneOffset.ofHours(-6)); System.out.println(d); ZoneOffset offset = d.getOffset(); System.out.println(offset); }}
17:40:33.000020-06:00-06:00