package com.javarush.task.task08.task0827;
import java.util.Date;
/*
Работа с датой
*/
public class Solution {
public static void main(String[] args) {
System.out.println(isDateOdd("JANUARY 2 1970"));
}
public static boolean isDateOdd(String date) {
Date nachaloGoda = new Date(date) ;
Date dateNow = new Date();
int countDaysNow = (int) (dateNow.getTime() / 60 / 60 / 24/1000);
// System.out.println(countDaysNow);
int doNachalaGoda = (int)(nachaloGoda.getTime()/ 60 / 60 / 24 / 1000);
int proshloDney = countDaysNow -doNachalaGoda;
if(proshloDney %2 ==0){
return true;
}
return false;
}
}package com.javarush.task.task08.task0827;
import java.util.Date;
/*
Работа с датой
*/
public class Solution {
public static void main(String[] args) {
System.out.println(isDateOdd("MAY 4 2013"));
}
public static boolean isDateOdd(String date) {
Date nachaloGoda = new Date(date) ;
Date dateNow = new Date();
int countDaysNow = (int) (dateNow.getTime() / 60 / 60 / 24/1000);
// System.out.println(countDaysNow);
int doNachalaGoda = (int)(nachaloGoda.getTime()/ 60 / 60 / 24 / 1000);
int proshloDney = countDaysNow -doNachalaGoda;
if(proshloDney %2 ==0){
return true;
}
return false;
}
}