# Discussions

View Only

## Formula check box that is check during the hours of 8am-8pm Mon-Fri

• #### 1.  Formula check box that is check during the hours of 8am-8pm Mon-Fri

Posted 18 days ago
I need a checkbox to help communicate the right message according to our hours of operation. Has anyone created anything like this?

------------------------------
Kelly
------------------------------

• #### 2.  RE: Formula check box that is check during the hours of 8am-8pm Mon-Fri

Posted 17 days ago
Kelly,

You are going to have to play with the time variable based upon your time zone but this should do the trick.

// Day Variable
var number NumDay = DayOfWeek(Today());
var bool MonToFri = Case(\$NumDay,
0,false,
1,true,
2,true,
3,true,
4,true,
5,true,
6,false);

// Time Variables
var timeofday CurrentTime = ToTimeOfDay(Now());
var bool EightToEight = If ( ToTimeOfDay("8:00AM")<\$CurrentTime and ToTimeOfDay("8:00PM")<\$CurrentTime,true, false );

// Formula Check Box
If ( \$MonToFri=true and \$EightToEight=true, true, false)

------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------

• #### 3.  RE: Formula check box that is check during the hours of 8am-8pm Mon-Fri

Posted 17 days ago
Thanks, Don! I'll try this out and let you know =)

• #### 4.  RE: Formula check box that is check during the hours of 8am-8pm Mon-Fri

Posted 17 days ago
Kelly,

I made a mistake in the variable EightToEight.   The second half had 8PM being before the Current Time.  Here is the simple correction.

var bool EightToEight = If ( ToTimeOfDay("8:00AM")<\$CurrentTime and \$CurrentTime< ToTimeOfDay("8:00PM"),true, false );

------------------------------
Don Larson
Paasporter
Westlake OH
------------------------------

• #### 5.  RE: Formula check box that is check during the hours of 8am-8pm Mon-Fri

Posted 17 days ago
Thank you!