Java Date Time Java Java API
java.time.OffsetDateTime
public ZoneOffset getOffset()
Returns a corresponding ZoneOffset instance.
package com.logicbig.example.offsetdatetime;import java.time.LocalDateTime;import java.time.OffsetDateTime;import java.time.ZoneOffset;public class GetOffsetExample { public static void main (String... args) { OffsetDateTime d = OffsetDateTime.of(LocalDateTime.of(2010, 10, 3, 11, 43, 30, 1000), ZoneOffset.ofHours(-5)); ZoneOffset offset = d.getOffset(); System.out.println(offset); System.out.println(offset.getId()); }}
-05:00-05:00