# Ability to choose task by days of week

**URL:** <https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828>\
**Category:** Ask the Community\
**Created:** [February 25, 2023, 10:45pm UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828 "2023-02-25T22:45:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [February 25, 2023, 10:45pm UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828/1 "2023-02-25T22:45:45Z")

</div>

Those who have used the Task feature know that currently users ONLY has the ability to choose “daily, weekly or monthly” to preform task. I would like to know if there is a work around (code) that gives the ability to choose the days of the week to perform a task (Mon, Tues etc…) or even weekdays or weekends.

Currently we have a task that turns on a certain feature for our customers during working hours. “On” @ 8am, “Off” @ 5pm. Works pretty good. The problem is, we are closed on the weekends and because there is no weekend selection in the task setup just daily, the feature for our customers is ON during the weekend hours of 8-5. If one of our employees or myself remember, we log into the builder side of Knack and manually turn feature OFF. We must perform this manual override for both days of the weekend (SAT/SUN).

Any and all solutions is appreciated… JON

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Brötz](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/wolfgang_br%C3%B6tz/32/1465_2.png) [@Wolfgang\_Brötz](https://forums.knack.com/u/Wolfgang_Br%C3%B6tz)\
**Post date:** [February 25, 2023, 11:05pm UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828/2 "2023-02-25T23:05:58Z")

</div>

Hi @Jon1,

would a condition excluding certain weekdays calculated with the function “getDateDayofWeek” solve your problem?

![Run Task when](https://us1.discourse-cdn.com/flex020/uploads/knack/original/2X/6/6c0cf245918bf375d0595b426abfef8d610108f6.png)

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [February 26, 2023, 12:08am UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828/3 "2023-02-26T00:08:46Z")

</div>

Hey Wolfang, it’s worth a shot… Do you mind helping me set the perimeters of the function?

I would like to have the task “ON” M-F and OFF (Sat/Sun).

Thanks again for the quick response and possible solution… JON

---

<div class="post-metadata">

**Author:** ![BradStevens](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/bradstevens/32/140_2.png) [@BradStevens](https://forums.knack.com/u/BradStevens)\
**Post date:** [February 26, 2023, 6:32am UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828/4 "2023-02-26T06:32:26Z")

</div>

@Jon1 - @Wolfgang_Brötz is right and we use this a lot to run tasks during the week and not weekends.

@Wolfgang_Brötz not sure how you’ve been able to insert the formula into the ‘When’ criteria for a task as we can can only select existing fields?

So for us:

1. Create a text formula field to store the current day - getDateDayOfWeekName(currentTime())
2. Create a task and use the CurrentDay #1 field in your filters to exclude or include the days you want.

The function is described here [Knack builder guide \> Text formula functions \> Date functions](https://learn.knack.com/article/z2uiemxq8t-text-formula-functions#date-functions) and you’d need to filter out days that contain Saturday or Sunday.

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Brötz](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/wolfgang_br%C3%B6tz/32/1465_2.png) [@Wolfgang\_Brötz](https://forums.knack.com/u/Wolfgang_Br%C3%B6tz)\
**Post date:** [February 26, 2023, 8:48am UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828/5 "2023-02-26T08:48:42Z")

</div>

Hi @BradStevens,

i renamed the field to make the screenshot easier to understand. This felds calculates the weekday and tests it, e.g. “is the weekday of this date a weekend?”

---

<div class="post-metadata">

**Author:** ![Jon1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@Jon1](https://forums.knack.com/u/Jon1)\
**Post date:** [February 26, 2023, 12:16pm UTC](https://forums.knack.com/t/ability-to-choose-task-by-days-of-week/13828/6 "2023-02-26T12:16:33Z")

</div>

@BradStevens, thank you for your assistance.

When creating a equation field I choose “numeric” as the equation type, with no other options selected.

I’m assuming the current day of week (Sunday) is “1” and Saturday is “7”.

If the above is correct, task was set to run when CurrentDay is not 1 and CurrentDay is not 7.

Thank you… JON
