# Get the number of a week day using Flow Script

**URL:** <https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388>\
**Category:** Flow Classic\
**Created:** [February 8, 2023, 12:59pm UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388 "2023-02-08T12:59:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alluse](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/alluse/32/1013_2.png) [@Alluse](https://forum.novacura.com/u/Alluse)\
**Post date:** [February 8, 2023, 12:59pm UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388/1 "2023-02-08T12:59:30Z")

</div>

Hi,

Asking for a customer. Is there a way to get the number of a weekday in Flowscript? With the format function you can get weekdays based on a date as text, Monday,Tuesday etc. But is there a way to get 1,2,3 and so on, making it non locale dependent.

> **[Formats](https://help.novacuraflow.com/development/flowscript/formats#date-and-time-format)**

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/novacuratalk/original/1X/35f53282ecaed9be0e999c4b523a0404e311480b.png)

---

<div class="post-metadata">

**Author:** ![OlaCarlander](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/olacarlander/32/205_2.png) [@OlaCarlander](https://forum.novacura.com/u/OlaCarlander)\
**Post date:** [February 8, 2023, 9:56pm UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388/2 "2023-02-08T21:56:13Z")

</div>

Hi,  
Not sure about flow script but there is always the option to jump in to a sql connector and get it. E.g. datepart in mssql and something similar in PL.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/7C9FD7/32.png) [@Andreas](https://forum.novacura.com/u/Andreas)\
**Post date:** [February 9, 2023, 6:56am UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388/3 "2023-02-09T06:56:11Z")

</div>

What we are trying to get is next working day.  
IFS has a funktion in PL, but we are switching to Odata and cannot find the endpoint for it.  
So in this case I want to first “filter” away all weekends and then exeptions but in flow they are dependent on the users language setting. So if i use “yyy” I get lör, sön or sat, sun etc and all other languages our users can have.  
So what i would like is day in week like you get with PL “SELECT to\_char(sysdate, ‘D’) FROM dual;”

---

<div class="post-metadata">

**Author:** ![ivstde](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/ivstde/32/146_2.png) [@ivstde](https://forum.novacura.com/u/ivstde)\
**Post date:** [February 9, 2023, 9:43am UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388/4 "2023-02-09T09:43:58Z")

</div>

Hi,  
when I use format(now(),“dddd”) in webclient I constantly keep getting Monday, Tuesday… no matter what the locale setings of the machine i am running the client on is, what the language in the browser is or the language /locale of the user running the flow.  
So for me this works:  
{case  
when format(now(),“dddd”) = ‘Monday’ then 1  
when format(now(),“dddd”) = ‘Tuesday’ then 2  
when format(now(),“dddd”) = ‘Wednesday’ then 3  
when format(now(),“dddd”) = ‘Thursday’ then 4  
when format(now(),“dddd”) = ‘Friday’ then 5  
when format(now(),“dddd”) = ‘Saturday’ then 6  
else 7  
end}

Hope this helps!

B R  
Ivan

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/7C9FD7/32.png) [@Andreas](https://forum.novacura.com/u/Andreas)\
**Post date:** [February 9, 2023, 10:26am UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388/5 "2023-02-09T10:26:28Z")

</div>

Hi Ivan

When I run the same I right now get the Swedish name for Thursday so not really sure what it picks it up from.  
I have a workaround for it and hat is to in a desition step check if saturday or sunday or lördag, or söndag etc etc.  
So it works but would like to find a better solution for it where you don’t have to “hope” you never get a new language 🙂

---

<div class="post-metadata">

**Author:** ![ivstde](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.novacura.com/ivstde/32/146_2.png) [@ivstde](https://forum.novacura.com/u/ivstde)\
**Post date:** [February 9, 2023, 11:08am UTC](https://forum.novacura.com/t/get-the-number-of-a-week-day-using-flow-script/388/6 "2023-02-09T11:08:14Z")

</div>

Hi,  
yeah couldnt realy figure out what the language returned depends on, but i was happy its at least consistent and no amount of switching flow user languages or machines would break it for me 🙂  
My best guess was that its the flow server locale that determines it (since on a German on prem server it says Donnerstag for any Flow user language/locale/browser language combo)
