I am trying to count the weekdays from the start of the month till today. I need the number to further calculate the average calls per workday by an agent. This is why I need to exclude the weekends.
Hi there, @chiara1… this post is probably the best way to go, but you can hack something together if you don’t want to use a plugin. I did something quite a while ago where I got the week number of the second date in the range and subtracted the week number of the first date in the range, multiplied the result by 2, and subtracted that number from the number of days in the range. See, hacky, but it did the trick for my use case.
You can create a list of days, starting in “Current Date/time:rounded down to month” until “Current Date/time” filtered by dates where the day is not 0 (Sunday) or 6 (Saturday). Use :count to know the number of the days in this list.
I went down that path ages ago, @rpetribu, but as plenty of threads in the forum point out, creating a list of dates in a date range without using a plugin is damn near (if not) impossible. So, at that point, you might as well use the plugin in the post in my initial reply. I didn’t want to use a plugin, and because I couldn’t create the list of dates I needed, I came up with the hack I described.