I have to use the Java Date
class for this problem (it interfaces with something out of my control).
How do I get the start and end date of a year and then
An improvement over Srini's answer.
Determine the last date of the year using Calendar.getActualMaximum
.
Calendar cal = Calendar.getInstance();
calDate.set(Calendar.DAY_OF_YEAR, 1);
Date yearStartDate = calDate.getTime();
calDate.set(Calendar.DAY_OF_YEAR, calDate.getActualMaximum(Calendar.DAY_OF_YEAR));
Date yearEndDate = calDate.getTime();