Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static int gettimeinhours(long t) { Calendar c = new GregorianCalendar(); c.setTime(new Date(t)); return c.get(Calendar.HOUR_OF_DAY); } }