get Time Field via Calendar - Android java.util

Android examples for java.util:Time

Description

get Time Field via Calendar

Demo Code


//package com.java2s;

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

public class Main {
    private static int getTimeField(Date time, int field) {
        Calendar calendar = GregorianCalendar.getInstance();
        calendar.setTime(time);//from ww  w  .ja va2s  .  com
        return calendar.get(field);
    }
}

Related Tutorials