how i can set Weekend
Application Type

how i can set Weekend

in my system 

working 5 days of week and weekend 2 days 

 i need Know the system the weekend =  a friday and a saturday

i need set weekend (a friday and a saturday)  

how can do this

Rank: #71

Hello Andrew.

Can you be more specific on what you are trying to do?

You can see what day of the week a date is with the function DayOfWeek(). What you do with it, will depend on your goal.

Rank: #1399

i need 


 user select vacation request From 26/2/2020 to 3/3/2021 

and Within this request There is a Friday or Saturday in this case. I want not to count these two days

when i use diffdays function 

how i can do this   

Rank: #898

@andrew mahfouz 

You can use something like this...

Create an action with StartDate and EndDate as inputs and then execute a query that returns a list of dates between the start and end date

Then apply a for each that will compare if the day is Friday or Saturday, using the function that Nuno Reis said DayOfWeek() .

Check the screenshots

Hope this helps.


Gonçalo Almeida

Rank: #1399

can upload Oml 

Rank: #898


Gonçalo Almeida


Rank: #287

Hi andrew ,

You don't need to use sql. There is DayOfWeek build-in function.

Please also refer to  https://success.outsystems.com/Documentation/10/Reference/Logic/Built-in_Functions/Date_and_Time_Built-in_Functions for more detailed information.


Rank: #898

@Tom Zhao 

For the use case, he needs the sql in order to return a list of dates between a start and an end date, and then use the dayOfWeek() function to check if it's weekend or not by date.

At least that is my opinion.


Gonçalo Almeida

Rank: #287

Hi @Goncalo Almeida 

Sorry, I didn't read your answer carefully.  But it could achieve the same feature without SQL.

Kind regards,

Rank: #1399
Rank: #523

Use DayOfWeek(DateTime).

If it returns a 5 (Friday) or a 6 (Saturday) it's weekend (for your scenario).

Rank: #383

Andrew, one question,

what I could see you want to know the number of vacation days not the number of weekends (Friday/Saturday) on your case, right?

You could do as Tom Zhao says but instead of counting  the weekday 5 or 6, count the other ones.

Also if you need the days, you could build a string with the dates separated by a single character like , or ; or #, your choice.

The best way I thing is to create a function witch returns what you want the way you want.

Best regards  

Rank: #71

Because this topic is now active again, and you are answering a distinct question, here goes the full flow:

Use DiffDays to get how many days exist between the two dates. Do Trunc of the difference by 7 to get the number of full weeks.

Weeks = Trunc(DiffDays(Date2,Date1)/7)

Now you have saved a few calculations.

For the final 0 to 6 days, just test if they are working days or weekends and add them to whichever variable is suitable.

Advance to the next day and repeat.