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.

2 Likes