I want to check the existence of the date, I have int variables ( representing format ) - day( dd ), month ( MM ) and year ( YY ). Here's my code:
SimpleDateFormat df = new SimpleDateFormat("YYMMdd");
df.setLenient(false);
try {
Date d = df.parse(""+day+month+year);
} ...
Because variables are in int I have problem when day for example can be 01 ( 1 digit in int ), or 21 ( 2 digits in int ) and I'm getting error as I have 'dd' in my format. Is there an easy way how I can use my numbers to check the validity of the date?