How to create a date range in kdb excluding weekends?

This code creates a sequence of dates:

firstdate: 2008.06.01
lastdate: 2008.08.31
daterange: firstdate + til (lastdate - firstdate) + 1

Is it possible to create the same range excluding weekend dates (Sat / Sun)?

+5
source share
2 answers
q)daterange where not (daterange mod 7) in 0 1 
2008.06.02 2008.06.03 2008.06.04 2008.06.05 2008.06.06 2008.06.09 2008.06.10 ..
q)
+5
source

it would be easier to do daterange where 1<daterange mod 7

+3
source

All Articles