Here you can find the source of getDateByYearAndMonth(int year, int month)
public static Date getDateByYearAndMonth(int year, int month)
//package com.java2s; //License from project: Apache License import java.sql.Date; import java.util.Calendar; public class Main { /**/* www .j a v a 2s.c o m*/ * * get a date by year and month * @param year * @param month * @return * Date * @throws */ public static Date getDateByYearAndMonth(int year, int month) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); Date date = new Date(calendar.getTimeInMillis()); return date; } }