Gets a timestamp in milliseconds from hour and minute of day. - Android java.util

Android examples for java.util:Millisecond

Description

Gets a timestamp in milliseconds from hour and minute of day.

Demo Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    /**/*from www  .  j  a v a 2s .c  o  m*/
     * Gets a timestamp in milliseconds from hour and minute of day. 
     * @param hour      Hour of day.
     * @param minute    Minute of day.
     * @return          Timestamp in milliseconds.
     */
    public static Long getTimeInMilliseconds(int hour, int minute) {
        Calendar time = Calendar.getInstance();
        time.set(Calendar.HOUR_OF_DAY, hour);
        time.set(Calendar.MINUTE, minute);
        return time.getTimeInMillis();
    }
}

Related Tutorials