Here you can find the source of getHour(long dateTimeMillis)
public static int getHour(long dateTimeMillis)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static int getHour(long dateTimeMillis) { SimpleDateFormat format = new SimpleDateFormat("HH"); StringBuilder dateString = new StringBuilder( format.format(dateTimeMillis)); return Integer.parseInt(dateString.toString()); }//from w w w . j a v a2 s.c o m }