I need to get the first date of the current quarter as a java.util.Date object and the last date of the current quarter as a java.util.Date
you can use java 8 LocaDate to get current quarter first and last day
The code below gives you.
public static LocalDate getCurrentQuarterStartDay(LocalDate date) {
return date.with(IsoFields.DAY_OF_QUARTER, 1L);
}
public static LocalDate getCurrentQuarterEndDate(LocalDate date) {
return date.with(IsoFields.DAY_OF_QUARTER, 92L);
}
Here in second method the 92 has partially lenient
The day-of-quarter has values from 1 to 90 in Q1 of a standard year, from 1 to 91in Q1 of a leap year, from 1 to 91 in Q2 and from 1 to 92 in Q3 and Q4
see ISOFields documentation for details here