Hello All,
I'm completing a payroll system within Navision and the data received is in DateTime fields and requires rounding (using the 15/7 quarter hour rule). I have figured a solution for this whereas I bring to the minutes to int and evaluate them against a table and then decide if the round is up or down and then try to evaluate this back to time and the back to date time.
This method is very clunky with several areas that could potentially fail especially on a 11:59pm (23:59) punch that would require change both date and time to the next day.
The rules are as follows.
If the minute are
00-07 round to 00
08-15 round to 15
16-22 round to 15
23-30 round to 30
31-37 round to 30
38-45 round to 45
46-52 round to 45
53-59 round to 60 ---> or the next day if 11:59PM (23:59)
Does anyone have ideas to streamline this process?
Thanks
Steve
0
Answers
From there you can determine the number of seconds / minutes / hours using the FORMAT function. Then a large CASE statement should do.
May be an easier way, but it's early on a Saturday morning and I'm still a little tired.
That is very easy
ROUNDDATETIME(DateTime,15 * 60000)
Best Regards
Bjarne
I have never seen that function. Must take a look and see what it does.
Neat function, I never saw it before, thanks for pointing it out.