## Between hours in a day

0
Hi,   I want to create an expression for  1 day = 16 hours → 8hours + 8 hours and the shift timing should be from 6AM till 10PM. The Breakdown start date and end date should not accept the accept beyond or before the shift time. can anyone please help me with this.
0

Hi sasank,

If I understand the issue, I present some insights, and potential solutions:

1.
2. Create a Microflow:

• Create a microflow in Mendix to handle the logic.
• Add parameters for the start date, end date, and shift time.
3. Check Shift Timing:

• Use a conditional statement to check if the provided start and end times fall within the specified shift time range (6 AM to 10 PM).
• You can use the `parseDateTime` function to convert the times to datetime objects for easier comparison.
1. Example (pseudo-code):

``if (parseDateTime(\$startDate) >= parseDateTime('6:00 AM') && parseDateTime(\$endDate) <= parseDateTime('10:00 PM')) { // Dates are within the shift time range // Continue with further logic } else { // Show an error message or handle it as per your requirement } ``
2. Calculate Working Hours:

• Calculate the working hours based on your requirement (1 day = 16 hours → 8 hours + 8 hours).

Example (pseudo-code):

``\$totalHours = 16; // Total hours in a day \$firstShiftHours = 8; // Hours for the first shift \$secondShiftHours = 8; // Hours for the second shift ``
3. Display Error or Proceed:

• If the dates and shift time are valid, proceed with the rest of your logic.
• If there is an issue with the dates or shift time, display an error message or take appropriate actions.

This is a basic outline, and the actual implementation may vary based on your specific use case and data model. Adjust the code accordingly, considering the data types and attributes in your Mendix application.

** Kindly  accept my answer if it assist you to solve your problem.