Skip to main content

Hi All, 

Can someone advise how to set validation on the time portion of the date and time in Nintex Forms?

I have a Date/Time field that I was to require people to change form the Default 12AM.

Thanks!

Can anyone advise?


rule with formula like this should work

equals(formatDate(StartDate,'hhtt'),'12AM')

note it will only validate when date portion is filled as well.


‌ - did this work out for you?

‌ -- in your formula, I'm guessing that '12AM' is whatever time you need that default to be ... but what would be input to 'hhtt'?  


Sure you can check for any hour you want.

But I do not get what you mean 'input to hhtt'

It's a format string that directs formatDate() function to return hour and AM/PM flag out of supplied date, so ithas always to be there in that form.


this worked for me, but i have another question related to time portion only

how to validate "Meeting Requested Time" to be >= 5 hours from the current time, which is the form submission time?

the "Meeting Requested Time" is a named control for Date/time field


this worked for me, but i have another question related to time portion only

how to validate "Meeting Requested Time" to be >= 5 hours from the current time, which is the form submission time?

the "Meeting Requested Time" is a named control for Date/time field


have a look on DateFiffHours() function

https://help.nintex.com/en-US/nintex2013/help/#Forms/RootCategory/Designer/Nintex.Forms.RuntimeFunctions.htm?Highlight=d… 


thank you for your reply, i tried the DateFiffHours, it didnt calculate the correctly coz it consider the CurrentDate time as 12:00AM all the time

it didnt consider the real current time


that's not a problem of DateDiffHours() function.

it's problem of CurrentDate reference which is always created with 12:00AM.

to compare with exact current date and time use following formula

dateDiffHours(new Date (),DateCtrl)

I created my formula as:

dateDiffHours(new date(),RequestDate)

the when i previewed the form i got the error msg:

{The form is reporting the following errors:
NWF.RuntimeFunction.date.call is not a constructor}

and the calculated value didn't display any thing

any thing i missed here?


the formula HAS TO look exactly like I posted it.

there has to be capital 'D' in "new Date" and there has to be a space between "Date" and braces "()"


dateDiffHours(new Date (),RequestDate)

wooow, worked as a charm,

thank you so much, i was struggling everywhere to get it done

please let me know 2 things:

1- how to mark this as a solution

2- what is the "new Date" function? it was not listed any where, and where can i find a reference for these kind of functions?

once again many thanks 


next to each post header you should see green button 'Correct answer'. press it for the post you want mark as solution.

 

"new Date" creates javascript Date object. with no parameters supplied in parentheses with current date and time


equals(formatDate(StartDate,'hhtt'),'12AM')

How can I specify a time range? Say from 601PM - 859AM.


Reply