get Minute from Date - Android java.util

Android examples for java.util:Minute

Description

get Minute from Date

Demo Code


//package com.java2s;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static int getMinute(Date time) {
        return getTimeField(time, Calendar.MINUTE);
    }/*www.  j a  v a2  s .  c  o m*/

    private static int getTimeField(Date time, int field) {
        Calendar calendar = GregorianCalendar.getInstance();
        calendar.setTime(time);
        return calendar.get(field);
    }
}

Related Tutorials