In some of my reports I'd like to exclude events that happen on weekends as our app is a business application that isn't running on the weekends, yet we do code updates and resulting tests on the weekends that can skew the data.
I've Tried:
and toint(dayofweek(timestamp)) >= 1 and toint(dayofweek(timestamp)) >= 5 //between Monday and Friday
But dayofweek
returns a timespan, not an int, and the toint
conversion doesn't work (no error is thrown, but result is an empty column.
So how do you exclude weekends? Can you convert timespan
to int
another way? Or is there another way to skin this cat?
The following seems to work for me:
Following this line,
dayOfWeek
is an integer holding the day. From there you can slice and dice as needed.Another option would be to use
substring
- might be faster theparse
: