Gets hour of day from milliseconds. - Android java.util

Android examples for java.util:Millisecond

Description

Gets hour of day from milliseconds.

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    /**/*ww w.  ja  v  a  2  s  .  c om*/
     * Gets hour of day from milliseconds.
     * @param milliSeconds      Timestamp in milliseconds.
     * @return                  Hour of day.
     */
    public static int getHourFromMilliseconds(Long milliSeconds) {
        Calendar time = Calendar.getInstance();
        time.setTimeInMillis(milliSeconds);
        return time.get(Calendar.HOUR_OF_DAY);
    }
}

Related Tutorials