Validate a Date/time field to be within certain hours (i.e. 9am - 5pm)


Badge +1

Hi,

I have a Start Date/Time and and End Date/Time on a form.   I would like to validate that the Start and End Time are within business hours (i.e. 9am - 5pm).    Does anyone know how I would do that?

 

Thanks!Date/Time


2 replies

Userlevel 4
Badge +9
What type of form are you using ? (Classic, Responsive or New Responsive)
Badge +4

If you have a New Responsive form and you use 24 hours format. You could do something like:


 


Create a variable: StartTime - Type String: 
formatDate([Form].[dtStart],"HH")



Create a form rule: Business hours:


if convertToNumber([Form].[StartTime]) >= 9 and


   convertToNumber([Form].[StartTime]) <= 17


Then do something like:


Label1 value is:  Business hours


Else
Label1 value is: Outside business hours


 


Reply