cancel
Showing results for 
Search instead for 
Did you mean: 
praios81
Nintex Newbie

Compare two dates in Nintex Forms

Jump to solution

Hi everyone,

a customer is using a Nintex Forms 2016 list form to get some data from users. They use two text fields to catch two date values. They don't use calendar controls because the expected dates are long in the past and thus entering the dates with the date picker control is not very comfortable. Instead they use input masks to help the user.

After both dates are entered they want to compare both dates where Date A must not be after Date B. However as they are both text fields the comparison is not done numerical but by string comparison.

I tried to use runtime functions formatDate and convertToDate to try parsing both text values as date and compare them afterwards but with no success.

Anyone has any ideas what other things I could try? Converting it in a workflow and getting back to the user is not really an option as the form is relatively complex which is why we'd like to do the validation directly in the form.

Thanks for any help.

Enrico

0 Kudos
Reply
6 Replies
mlauer
Nintex Newbie

Re: Compare two dates in Nintex Forms

Jump to solution

Hi Enrico

no 2016 here but in 2013 following validation rule is working:

greaterThan(convertToDate(fdatum_von) , convertToDate(fdatum_bis) )

Kind regards

Manfred

Reply
praios81
Nintex Newbie

Re: Compare two dates in Nintex Forms

Jump to solution

Hi Manfred,

thanks for the quick relby. I tried that before but the convertToDate() function always puts out #Value!, thus the rule validates #Value! > #Value! instead of converted dates. It doesn't get that 01.06.2017 is a date :/

Reply
Automation Master
Automation Master

Re: Compare two dates in Nintex Forms

Jump to solution

Hi Enrico,

I've done some test and here is what I've found:

using convertToDate(), the argument should be in a valid format based on the Regional Settings of the site (if you have the american format for the date, it should be Month/Day/Year, european format asks for day/month/year)

plus, I've test with regional settings English (United Kingdom), part of the date should be separated with a slash and not with a dot..if it's possible to change how users write the dates (30/05/2017 instead of 30.05.2017), then the function should work..

Giacomo

Reply
lakshminarayana
Nintex Newbie

Re: Compare two dates in Nintex Forms

Jump to solution

Hi Enrico Knapp‌,

You have to enter the dates as below to work with the 'convertToDate' function.

Other wise it will be difficult to convert the user format for date comparison.

Thanks,

Reply
praios81
Nintex Newbie

Re: Compare two dates in Nintex Forms

Jump to solution

Ugh... seems to be a problem with the German date format.

If I just use a formula to write down the date entered above it writes the date but except the dots. It just treats my date as a number, removes leading zeros and the dots.

The conversion of this value fails as described.

If I manually break up the value and readd the dots the conversion works...

Manfred Lauer‌, I wonder why this is happening to me. It seems to work in your environment with German format too.

Is there any way to force Nintex to just treat my string as a string?

Meh...

Reply
praios81
Nintex Newbie

Re: Compare two dates in Nintex Forms

Jump to solution

Finally ended up with reformatting all my "number" date and added dots manually to make conversion action work with German date format.

It works now but it's a lot of effort but at least it's working now.

Thanks for all suggestions though.

Enrico

View solution in original post

0 Kudos
Reply