Android examples for java.util:Hour
get Hour Of Day
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static int getHourOfDay(Date time) { return getTimeField(time, Calendar.HOUR_OF_DAY); }//from w ww . ja v a 2 s. c o m private static int getTimeField(Date time, int field) { Calendar calendar = GregorianCalendar.getInstance(); calendar.setTime(time); return calendar.get(field); } }