I had tried every date it's working alright and returning value. Sill not able to pass the third requirement which says try other dates.
package com.codegym.task.task08.task0827;
import java.util.*;
import java.time.*;
/*
Working with dates
*/
public class Solution {
public static void main(String[] args) {
System.out.println(isDateOdd("FEBRUARY 0 2013"));
}
public static boolean isDateOdd(String date) {
Date d = new Date(date);
Calendar cal = Calendar.getInstance();
cal.setLenient(false);
cal.setTime(d);
try {
System.out.println(cal.getTime());
cal.getTime();
}
catch (Exception e) {
System.out.println("Invalid date");
}
int n = cal.get(Calendar.DAY_OF_MONTH);
if(n%2==0) return false;
else return true;
}
}