Hi,
First, you have to find the quarter of the year for the current date and time. For that quarter you Should pre-defined the Start date and End date.
Use Java Functions if required, Simply solved
import java.time.LocalDate;
import java.time.temporal.TemporalAdjusters;
public class StartAndEndOfTheQuater{
public static void main(String []args){
LocalDate localDate = LocalDate.now();
LocalDate firstDayOfQuarter = localDate.with(localDate.getMonth().firstMonthOfQuarter())
.with(TemporalAdjusters.firstDayOfMonth());
LocalDate lastDayOfQuarter = firstDayOfQuarter.plusMonths(2)
.with(TemporalAdjusters.lastDayOfMonth());
System.out.println (" start: " + firstDayOfQuarter + " stop: " + lastDayOfQuarter );
}
}
In Mendix Java Action, You can do like this
public Java_action(IContext context, java.lang.Boolean isFirstDay)
{
super(context);
this.isFirstDay = isFirstDay;
}
@java.lang.Override
public java.util.Date executeAction() throws Exception
{
// BEGIN USER CODE
LocalDate localDate = LocalDate.now();
if(isFirstDay){
LocalDate firstDayOfQuarter = localDate.with(localDate.getMonth().firstMonthOfQuarter()).with(TemporalAdjusters.firstDayOfMonth());
return new SimpleDateFormat("yyyy-MM-dd").parse(firstDayOfQuarter.toString());
} else {
LocalDate lastDayOfQuarter = firstDayOfQuarter.plusMonths(2).with(TemporalAdjusters.lastDayOfMonth());
return new SimpleDateFormat("yyyy-MM-dd").parse(firstDayOfQuarter.toString());
}
// END USER CODE
}