Here you can find the source of getHour(long dateTimeMillis)
public static int getHour(long dateTimeMillis)
//package com.java2s; 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()); }// ww w .j a v a 2 s .c o m }