DateDiff function in Entra Id provisioning does not correctly identify same date...

Shaun Young (CloudAdmin) 0 Reputation points
2026-01-06T16:16:18.5033333+00:00

I'm working with the Workday Writeback provisioning app & we have a requirement that the users UPN should not be written back to Workday until the day of the employees hire date.
(Documentation here: https://learn.microsoft.com/en-us/entra/identity/saas-apps/workday-writeback-tutorial#timing-the-writeback-for-pre-hires)

I've found multiple issues with MS's documentation surrounding the IIF function already, including in the following documentation: https://learn.microsoft.com/en-us/entra/identity/saas-apps/workday-writeback-tutorial#timing-the-writeback-for-pre-hires, where it shows in the example query provided that the IIF function should be as follows: IIF(Condition, False, true). It also impacts most other documentation that includes the IIF function... (IE in examples provided for the DateDiff function itself: https://learn.microsoft.com/en-gb/entra/identity/app-provisioning/functions-for-customizing-application-data#datediff)

However the IIF function is actually documented (on the same page) to be as follows: IIF(condition, True, False). https://learn.microsoft.com/en-us/entra/identity/app-provisioning/functions-for-customizing-application-data#iif

While debugging the above issue, I have also found that the DateDiff function doesn't actually compare the dates correctly.

For instance: DateDiff("2026-01-06-01:00", "2026-01-06-09:00") = 0
User's image
however, DateDiff("2026-01-06-01:00", "2026-01-06-23:00") = 1 (tomorrow)
User's image Both should be "0", because they are in fact the same date, however, it appears that the DateDiff function doesn't actually check the date at all... instead it simply takes the time & applies a +/- 12 hour sum, if the difference (Now() VS Now(-13 hours)) is true, it returns "-1" (yesterday).
User's image
This flawed logic has a knock on impact for multiple MS products including Power Automate Azure Provisioning, as it incorrectly assumes a 12 hour day (or simply ignores the fact that both timestamps are within the same dates 24 hour period).

Does anyone have a workaround for this?

Microsoft Security | Microsoft Entra | Microsoft Entra ID

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.