Here you can find the source of createDate(final int day, final int month, final int year)
Parameter | Description |
---|---|
day | the day of the month, 1-31. |
month | the month, 1-12. |
year | the year. |
public static Date createDate(final int day, final int month, final int year)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**//from www . jav a2 s .c o m * Creates a date from the given components. * * @param day the day of the month, 1-31. * @param month the month, 1-12. * @param year the year. * @return a date with the specified settings. */ public static Date createDate(final int day, final int month, final int year) { Calendar cal = Calendar.getInstance(); cal.clear(); cal.set(Calendar.DAY_OF_MONTH, day); cal.set(Calendar.MONTH, month - 1); cal.set(Calendar.YEAR, year); return cal.getTime(); } }