AnsweredAssumed Answered

Date Comparison in WF

Question asked by janp on Mar 6, 2015
Latest reply on Dec 17, 2017 by kjhawkins

I've run into some trouble trying to compare date fields.


I have a date value - dateNow which I calculate using the Calcuate Date control while using the "use date when action is executed" and "include time".

I then compare it to a From and a To value to see if a specific schedule applies. (these are Date & Time columns)


In my Query List action I check that the From <= dateNow <= TO.


The WF logs this:


FROM: 2015-03-06 9:00 AM

dateNow: 2015-03-06 3:48 PM

TO: 2015-03-06 3:00 PM


This means that dateNow is clearly outside of the interval (greater than TO) yet I still get this selection as part of my results.

Basically it seems as if the "visible" values didn't match the values when doing the comparison.


I ran into a similar issue in Visual Studio where the actual date value provided by SP was different than the display one. There I could resolve it with a Convert.ToDateTime and then a comparison to UtcNow. No idea how I'd go about doing that in the NWF.