Java Date Time Java Java API
java.time.OffsetTime
public int getHour()
Returns the hour-of-day field from this OffsetTime instance.
package com.logicbig.example.offsettime;import java.time.OffsetTime;public class GetHourExample { public static void main(String... args) { OffsetTime d = OffsetTime.now(); System.out.println(d); int hour = d.getHour(); System.out.println(hour); }}
16:14:39.424-05:0016