This code works fine, but not passing the Requirements why???
package com.codegym.task.task08.task0827;
import java.util.Date;
/*
Working with dates
*/
public class Solution {
public static void main(String[] args) {
System.out.println(isDateOdd("MAY 1 2013"));
}
public static boolean isDateOdd(String date) {
Date today = new Date(date);
Date yearStartTime = new Date();
yearStartTime.setHours(0);
yearStartTime.setMinutes(0);
yearStartTime.setSeconds(0);
yearStartTime.setDate(1); // First day of the month
yearStartTime.setMonth(0);
long Difference = today.getTime() - yearStartTime.getTime();
long msDay = 24 * 60 * 60 * 1000;
int dayCount = (int) (Difference/msDay);
if (dayCount % 2 != 0) {
return true;
}
else return false;
}
}