Java Date Time Java Java API
java.time.LocalDateTime
public int getHour()
Returns the hour-of-day field from this local date time.
package com.logicbig.example.localdatetime;import java.time.LocalDateTime;import java.time.Month;public class GetHourExample { public static void main (String... args) { LocalDateTime d = LocalDateTime.of(2010, Month.AUGUST, 10, 23, 11); System.out.println(d.getHour()); }}
23