I am currently setting a Date
using the following function.
private Date getDate (int day, int month, int year){
Calendar calendar = Calendar.getInstance();
calendar.set(year, month-1, day);
Date date = calendar.getTime();
return date;
}
However if (31, 6, 2014) is entered, the date is simply changed to the 1st of July 2014. Is there a way that I could check whether a date is valid if my input is as above?
Thanks for your help.