Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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()));
    }
}