The code is working. It runs and generates the required answer. According to the example they provided they want the first day of the year to be counted, right? I tried a million different dates and my answer is correct every time. The answer is correct, the logic is correct and the math is correct. I can't figure out why it is still failing. The requirement of the isDateOdd() method is refusing to resolve. Can anyone see what is wrong with my code? This is driving me crazy.
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("JUNE 15 2013"));
}
public static boolean isDateOdd(String date) {
Date startOfYear = new Date("DECEMBER 31 2012");
Date theDate = new Date(date);
long milsec = theDate.getTime() - startOfYear.getTime();
long days = ((((milsec/1000) /60) /60) /24);
// System.out.println(milsec);
// System.out.println(days);
if (days % 2 !=0)
return true;
else
return false;
}
}