I have tested my code for different in ide. It has shown correct results only but here its not accepting. can anyone help me please.
package com.codegym.task.task08.task0827;
import java.util.Date;
import java.util.*;
import java.lang.*;
import java.text.*;
/*
Working with dates
*/
public class Solution {
public static void main(String[] args) throws Exception{
System.out.println(isDateOdd("MAY 1 2013"));
}
public static boolean isDateOdd(String date) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd yyyy");
Date strtDate = sdf.parse("JAN 01 2013");
Date endDate = sdf.parse(date);
long days = (endDate.getTime() - strtDate.getTime())/(60*60*24*1000);
if((days-1)%2 != 0)
return true;
else
return false;
}
}