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 joda:
Date start = date.withMonthOfYear(((date.getMonthOfYear() / 3) + 1) * 3 - 2)
.withDayOfMonth(1)
.withTimeAtStartOfDay()
.toDate();
Date end = date.withMonthOfYear(((date.getMonthOfYear() / 3) + 1) * 3)
.withDayOfMonth(Month.of(((date.getMonthOfYear() / 3) + 1) * 3).maxLength())
.withTimeAtStartOfDay()
.toDate();
When DateTime date = new DateTime(2016, 8, 12, 1, 1, 1);
I get:
Fri Jul 01 00:00:00 CEST 2016
Fri Sep 30 00:00:00 CEST 2016