# Condition to check the day of the week

**URL:** <https://discourse.nodered.org/t/condition-to-check-the-day-of-the-week/90735>\
**Category:** General\
**Created:** [5 September 2024 12:37 UTC](https://discourse.nodered.org/t/condition-to-check-the-day-of-the-week/90735 "2024-09-05T12:37:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xfear1](https://avatars.discourse-cdn.com/v4/letter/x/4da419/32.png) [@xfear1](https://discourse.nodered.org/u/xfear1)\
**Post date:** [5 September 2024 12:37 UTC](https://discourse.nodered.org/t/condition-to-check-the-day-of-the-week/90735/1 "2024-09-05T12:37:40Z")

</div>

Hello,  
How can I do a function to check the day of the week?  
An example, I want to send information to a gauge only when is the correct day of the week.  
I want to have 7 gauges, for every day of the week. So if today is sunday it only sends my data to the sunday gauge and keeps the information for the rest of the weak on each gauge.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [5 September 2024 12:57 UTC](https://discourse.nodered.org/t/condition-to-check-the-day-of-the-week/90735/2 "2024-09-05T12:57:00Z")

</div>

@jbudd showed you how to get the day of the week using getDate() (value 0-6, sun to sat). [here](https://discourse.nodered.org/t/inputing-data-in-to-different-gauges-on-for-each-day-of-the-week/90704/2)  
You can use that outptut in a msg property, then use a switch node to direct, where rules would be -  
Property would be value you save the 0-6 in  
Rule 1 `== (number) 0`  
Rule 2 `== (number) 1`  
etc.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [5 September 2024 12:57 UTC](https://discourse.nodered.org/t/condition-to-check-the-day-of-the-week/90735/3 "2024-09-05T12:57:05Z")

</div>

> **[javascript day of week at DuckDuckGo](https://duckduckgo.com/?q=javascript%2Bday%2Bof%2Bweek)**
>
> DuckDuckGo. Privacy, Simplified.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 December 2024 12:57 UTC](https://discourse.nodered.org/t/condition-to-check-the-day-of-the-week/90735/4 "2024-12-04T12:57:40Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
