get Time From years months days Values - Android java.util

Android examples for java.util:Year

Description

get Time From years months days Values

Demo Code

import android.widget.DatePicker;
import java.util.Calendar;
import java.util.Date;

public class Main{

    /**/*from w  w w.ja va2  s.  c  o  m*/
     * Gets the time from values.
     *
     * @param years the years
     * @param months the months
     * @param days the days
     * @return the time from values
     */
    public static long getTimeFromValues(int years, int months, int days) {
        int day = days + 1;
        int month = months;
        int year = years + 1970;

        Calendar calendar = Calendar.getInstance();
        calendar.set(year, month, day);

        return calendar.getTime().getTime();
    }

}

Related Tutorials