Here's some java that will return the day of the week from an input date. Create a java action like the one below and pass your date to it, then check the returned string for which day of the week it is.
// This file was generated by Mendix Business Modeler 2.5. // // WARNING: Only the following code will be retained when actions are regenerated: // - the import list // - the code between BEGIN USER CODE and END USER CODE // - the code between BEGIN EXTRA CODE and END EXTRA CODE // Other code you write will be lost the next time you deploy the project. // Special characters, e.g., é, ö, à, etc. are supported in comments. package workinghours.actions; import com.mendix.systemwideinterfaces.core.UserAction; import java.util.Date; import java.util.Calendar; /** * */ public class Get_DayOfWeek extends UserAction<string> { private Date InputDate; public Get_DayOfWeek(Date InputDate) { super(); this.InputDate = InputDate; } @Override public String executeAction() throws Exception { // BEGIN USER CODE Calendar cal = Calendar.getInstance(); cal.setTime(InputDate); int dow = cal.get(Calendar.DAY_OF_WEEK); String tmpStr = Integer.toString(dow); return tmpStr; // END USER CODE } /** * Returns a string representation of this action */ @Override public String toString() { return "Get_DayOfWeek"; } // BEGIN EXTRA CODE // END EXTRA CODE }
As far as the unique requirement is concerned, after validating the start and end dates return the correct numbers, just do a retrieve action to find any existing matching records for that user.