How to use a range of DateTime as Dict keys

Hello,
Is there any way to to do this:
P1= DateTime(2015,08,1,12,00,00)
P2=DateTime(2015,08,1,20,00,00)
range(P1,P2) ==> 3
.
.
So then I would like to check time periods if they are between P1 and P2?

you could make key-value pairs by just using tuples.
(P1, P2) => 3
and could check the datetime by something like
P1 <= dt <= P2

there’s a sample package using Dates.
check its source code if you like.
https://github.com/wookay/Calendars.jl

2 Likes

Have a look to the TimeSeries.jl package.
It will let you specify a time range like this:

Example Description Indexing value
[Date(2000, 1, 3)] The row containing Jan 3, 2000 timestamp single Date
[[Date(2000, 1, 3), Date(2000, 2, 4)]] The rows containing Jan 3 & Feb 4, 2000 multiple Dates
[Date(2000, 1, 3):Day(1):Date(2000, 2, 4)] The rows between Jan 3, 2000 & Feb 4, 2000 range of Date