Skip to main content
Nintex Community Menu Bar
Solved

Rule for date

  • February 21, 2024
  • 4 replies
  • 103 views

Forum|alt.badge.img+5

Hello,

 

How I can make a rule to appear a message if the time out of working hours( from 8 to 4)

Best answer by Chris_Ben

Here’s one way of doing it.

 

Basically you grab the hour component from your date/time control and check to see if it’s earlier than 8 or after 16.  If it’s 16 you also need to check the minutes are not more than 0.

 

For ease of readability I’ve split it into 3 form variables.

 

Create an integer form variable called “Hour”:

convertToNumber(formatDate([Form].[Datetime],"HH"))

 

Create an integer form variable called “Minutes”:

 

convertToNumber(formatDate([Form].[Datetime],"mm"))

 

Create a boolean form variable called “Outside work hours”:

ifElse([Form].[Hour]<8||[Form].[Hour]>16,

    true,

ifElse([Form].[Hour]==16&&[Form].[Minutes]>0,

    true,

false))

 

Now you can write a submit rule:

 

4 replies

Chris_Ben
Nintex Employee
Forum|alt.badge.img+14
  • Nintex Employee
  • Answer
  • February 21, 2024

Here’s one way of doing it.

 

Basically you grab the hour component from your date/time control and check to see if it’s earlier than 8 or after 16.  If it’s 16 you also need to check the minutes are not more than 0.

 

For ease of readability I’ve split it into 3 form variables.

 

Create an integer form variable called “Hour”:

convertToNumber(formatDate([Form].[Datetime],"HH"))

 

Create an integer form variable called “Minutes”:

 

convertToNumber(formatDate([Form].[Datetime],"mm"))

 

Create a boolean form variable called “Outside work hours”:

ifElse([Form].[Hour]<8||[Form].[Hour]>16,

    true,

ifElse([Form].[Hour]==16&&[Form].[Minutes]>0,

    true,

false))

 

Now you can write a submit rule:

 


Forum|alt.badge.img+5
  • Author
  • Rookie
  • February 21, 2024

Hello,

 

from where I get 

[Form].[Datetime]

 


Chris_Ben
Nintex Employee
Forum|alt.badge.img+14
  • Nintex Employee
  • February 21, 2024

Hi - that would be whatever you named your date picker control on your form. 


Forum|alt.badge.img+5
  • Author
  • Rookie
  • April 1, 2024

thank you very much