• Nice work, R2ro! It seems that your function is the best, so far. Here are some timings (in ms) for the three versions (counting the rows in the result, for the dates between Jan 1, 2006 and Jan 31, 2307):

    PeterRazvanR2ro
    19061670

    766

    20762846796
    8301653876
    906610766
    8601703873
    31702846703

    As you can see, on my system, the timings are varying strangely, but on average, your method seems to be the best.

    Razvan