package de.codegym.task.task08.task0827;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/*
Mit Datumsangaben arbeiten
*/
public class Solution {
public static void main(String[] args) {
System.out.println(istUngeradesDatum("MAY 1 2013"));
System.out.println(istUngeradesDatum("January 1 2013"));
System.out.println(istUngeradesDatum("January 2 2013"));
}
public static boolean istUngeradesDatum(String date) {
DateFormat df = new SimpleDateFormat("MMMMM d yyyy");
Date nY = new Date("JANUARY 0 2013");
Date now = new Date(date);
int sil = (int) (nY.getTime() / 3600000 / 24);
int act = (int) (now.getTime() / 3600000 / 24);
int days = act - sil;
if(days %2 != 0) {
return true;
} else {
return false;
}
}
}