Any idea how to resolve this?
import java.util.*;
public class DateLib {
private final long DAYS_TO_HOURS = 24L;
private final long HOURS_TO_MINUTES = 60L;
private final long MINUTES_TO_SECONDS = 60L;
private final long SECONDS_TO_MILLISECONDS = 1000L;
public static long getMillisecondsFromEpoch (int aYear, int aMonth, int aDay) {
/*
* Epoch is January 1, 1970 00:00.00 000 GMT
*/
//TODO calculate no of Years to milliseconds
final long Year = (((long) aYear) - 1970L);
if (!(isLeapYear)) {
// ERROR: Exception in thread "main" java.lang.Error: Unresolved compilation //problem: isLeapYear cannot be resolved
}
else {
}
return Year;
}
public static long getMillisecondsFromEpoch (int aYear, int aMonth, int aDay,
int aHour, int aMinute, int aSecond)
{
/* TODO **
* Epoch is January 1, 1970 00:00.00 000 GMT
*/
return 0L;
}
private boolean isLeapYear (int aYear) {
/*
* if year modulo 400 is 0 then leap
* else if year modulo 100 is 0 then no_leap
* else if year modulo 4 is 0 then leap
* else no_leap
* (Source:
Leap year - Wikipedia, the free encyclopedia)
*/
if ((aYear % 400) == 0) {return true;}
else if ((aYear % 100) == 0) {return false;}
else if ((aYear % 4) == 0) {return true;}
else {return false;}
}
}