0
var getDate = new GlideDateTime("2023-07-31 04:41:46");
gs.print(getDate.getDayOfWeekLocalTime())

Output: 7

This method will return a numerical value between 1-7 as it corresponds to the number of days in a week

1 – Monday

2 – Tuesday

3 – Wednesday

4 – Thursday

5 – Friday

6 – Saturday

7 – Sunday

getDayOfWeekLocalTime() method return days in numerical value between 1-7
Working Code Asked question August 1, 2023