AnsweredAssumed Answered

What is the best way of comparing two dates in a workflow?

Question asked by dipetersen on Jan 27, 2017
Latest reply on Feb 4, 2017 by mmatsako

What is the best way of comparing two dates in a workflow?  I have the following use case:


I have two date/time variables, Ship1 and Ship2 and then I have another data/time variable that I will use to write to SQL.  Call that SQLShipDate.  My logic is as follows:


Set SQLShipDate = Ship1.

Set Ship2 from the list data.  If the list data is blank, the value that gets placed in here is 1/1/0001 12:00:00AM

I have a RUN-IF action that says, If Ship2 does not equal 1/1/0001 then SET SQLShipDate = Ship2


So on my TESTS here is what I get:


Ship1 = 1/26/2017

Ship2 = blank (1/1/0001)

SQLShipDate is 1/26/2017 (what it should be)


Ship1 = 1/26/2017

Ship2 = 3/1/2017

SQLShipDate is 1/26/2017 (this has failed the test.  It should be 3/1/2017)


As I run my workflows, the RUN-IF action never works.  No matter what date Ship2 is, it never passes the RUN-IF comparison.


I can't figure out what else to do.  Does anyone have any suggestions on how to do date comparisons or check a date variable for an empty value?  I also tried creating an empty date variable and comparing but that didn't work either.