Filtering DateTime range efficiently


#1

Hi,

I am studying how to work DateTime in Julia. The design is very intuitive. Well done! The possibility to create a DateTime range is particularly interesting.

Imagine a range as follows:

a = DateTime(2017, 1, 1, 0, 0)
b = DateTime(2017, 1, 2, 23, 45)
s = Dates.Minute(15)

dr = a:s:b

What is an effective way to filter, say every 4th and 5th quarter-hour, i.e. 2017-01-01 01:00:00, 2017-01-01 01:15:00, 2017-02-01 01:00:00, 2017-01-01 01:15:00 or say every 47th and 48th quarter-hour ? In reality a DateTime range could be much longer, e.g. several years.

The following works but I wonder whether this is the way it should be.
filter(x->Dates.hour(x)==1 && Dates.minute(x) in [0, 15], tr)

Thanks,
Jan