Get the number of a week day using Flow Script


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.

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.

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;”

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:
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

Hope this helps!


1 Like

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 :slight_smile:

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 :slight_smile:
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)