I'm grabbing some data from a database that has a stored date value, and I'm letting the user pick date ranges they would like to view data for. All my code for getting these date ranges works except for the method to get the date range covering all time, which would be a start value of the earliest possible data Java handles, to the end value of the max possible date.
Is there something wrong with my code, because I can't see a problem:
public static DateRange getAllTime() {
/**
* Get earliest possible
*/
Calendar c = Calendar.getInstance();
c.set(
c.getActualMinimum(Calendar.YEAR),
c.getActualMinimum(Calendar.MONTH),
c.getActualMinimum(Calendar.DAY_OF_MONTH),
c.getActualMinimum(Calendar.HOUR),
c.getActualMinimum(Calendar.MINUTE),
c.getActualMinimum(Calendar.SECOND)
);
c.set(Calendar.MILLISECOND, c.getActualMinimum(Calendar.MILLISECOND));
Date start = c.getTime();
/**
* Get latest possible date
*/
c.set(
c.getActualMaximum(Calendar.YEAR),
c.getActualMaximum(Calendar.MONTH),
c.getActualMaximum(Calendar.DAY_OF_MONTH),
c.getActualMaximum(Calendar.HOUR),
c.getActualMaximum(Calendar.MINUTE),
c.getActualMaximum(Calendar.SECOND)
);
c.set(Calendar.MILLISECOND, c.getActualMaximum(Calendar.MILLISECOND));
Date end = c.getTime();
DateRange range = new DateRange();
range.Start = start;
range.End = end;
return range;
}