Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** * Returns the current hour of the day as set on the device. * @return */ public static int getHourOfDay() { SimpleDateFormat format = new SimpleDateFormat("H"); format.setTimeZone(TimeZone.getTimeZone("UTC")); return Byte.parseByte(format.format(new Date())); } }