Skip to main content
Nintex Community Menu Bar

Validate Time portion of date/time control in a form

  • November 17, 2016
  • 14 replies
  • 44 views
  • Translate All

Forum|alt.badge.img+8

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!

14 replies

Forum|alt.badge.img+8
  • Author
  • November 18, 2016

Can anyone advise?

Translate

Forum|alt.badge.img+14
  • Scholar
  • November 21, 2016

rule with formula like this should work

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

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

Translate

rhia
Nintex Partner
Forum|alt.badge.img+15
  • Nintex Partner
  • February 25, 2017

‌ - 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'?  

Translate

Forum|alt.badge.img+14
  • Scholar
  • February 25, 2017

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.

Translate

Forum|alt.badge.img+3

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

Translate

Forum|alt.badge.img+3

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

Translate

Forum|alt.badge.img+14
  • Scholar
  • May 9, 2018

Forum|alt.badge.img+3

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

Translate

Forum|alt.badge.img+14
  • Scholar
  • May 14, 2018

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)‍
Translate

Forum|alt.badge.img+3

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?

Translate

Forum|alt.badge.img+14
  • Scholar
  • May 15, 2018

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 "()"

Translate

Forum|alt.badge.img+3

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 

Translate

Forum|alt.badge.img+14
  • Scholar
  • May 16, 2018

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

Translate

Forum|alt.badge.img+9
equals(formatDate(StartDate,'hhtt'),'12AM')

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

Translate