Create Calendar from year, month, day - Android java.util

Android examples for java.util:Year

Description

Create Calendar from year, month, day

Demo Code

import android.util.Log;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main{

    /**//from w  w w .jav a 2 s.c om
     * According your parameters, return the date.
     * 
     * @param year
     * 
     * @param month
     *            based on zero, zero means January
     * @param day
     *            day of month
     * @return
     */
    public static Date getDate(int year, int month, int day) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(year, month, day);
        return calendar.getTime();
    }

}

Related Tutorials