Skip to main content

In Nintex Forms I need to create an equals statement that checks against a hardcoded date. The problem I have is that I cannot determine the correct format for the hardcoded date to result in a "true" outcome.

As per the screenshot below, I have a date control called Date1 and a calculated value on the form:

1.PNG

I have configured the calculate value like this:

2.PNG

equals("27 April 2016 00:00:00", Date1)

When I use a calculated value to extract the value of the date picker it returns "27 April 2016 00:00:00" and I've tried pretty much all other variations I can think of e.g.:

  • 27/04/2016
  • 27-04-2016
  • 2016-04-27
  • 1461715200
  • 2016-04-27T00:00:00+00:00
  • Wed, 27 Apr 2016 01:00:00 +01:00

Any help would be appreciated happy.png

Hi Mitchell,

I believe that the problem is that you compare a string and a date.

Try to use convertToDate

Christophe


Thanks for the reply.

I've tried convertToDate but again cannot get the correct value:

  • equals(convertToDate("27 April 2016 00:00:00"), Date1)
  • equals(convertToDate("27/04/2016"), Date1)

Also tried:

  • equals(subString(Date1, 0, 12), "27 April 2016")
  • equals(subString(Date1, 0, 9), "27/04/2016")

Maybe this post can help


Hi Mitchell,

It should be equals(convertToDate("2016/04/27"),Date1).  Let me know if that still didn't work.


Thanks. Unfortunately no joy:

1.PNG

equals(convertToDate("2016/04/27"), Date1)

For information, the Regional Settings are as follows:

3.PNG


Hello Mitchell Slater​ – I've figured out what's causing your mismatch. When you perform the convertToDate function on "04/27/2016", a time of midnight is being included in the output (thus not matching your date-only Date1).

If you perform a formatDate() function for both your hard-coded value as well as your Date/Time field's value before evaluating the equals runtime function, you'll correctly get back true in your calculated field. 

Working formula:

equals(formatDate(convertToDate("04/27/2016"),"dd/MM/yyyy"), formatDate(Date1, "dd/MM/yyyy"))


That sounds crazy enough to work happy.png I'll test on Monday and get back to you. Thanks for the input!


No problem, happy to help!


Hi Patrick Abel, that worked perfectly.

equals(formatDate(convertToDate("27/04/2016"),"dd/MM/yyyy"), formatDate(Date1, "dd/MM/yyyy"))

Thanks a lot! happy.png


Awesome – glad that worked for you!


Reply