SQL is really bad at computing time, so specialised conventions and methods have evolved to make such problems manageable, eg as described in ...
Kimball R, "The Soul of the Data Warehouse, Part 3: Handling Time",
http://www.intelligententerprise.com//030422/607warehouse1_1.jhtml
Snodgrass R, "Developing Time-Oriented Database Applications in SQL",
http://www.cs.arizona.edu/~rts/tdbbook.pdf
Your table tracks time periods or intervals, Periods may be ...
closed-closed: includes both start and end
closed-open: includes the start, excludes the end
open-closed: excludes the start, includes the end
open-open: excludes both start and end
For most period queries including yours, the usual business default of closed-open is most efficient: if you book a hotel room for 22-24 May, the hotel will expect you to arrive in the afternoon of 22 May and leave in the morning of 24 May, having stayed the two days of the closed:closed period 22-23 May, or the closed:open period 22-24 May.
It'd be easy to edit your data to match the closed-open convention---just add a second to each datetime2 value.
If your requirement is as simple as you imply by not mentioning it, the "Peak visit counts by datetime period" query at
https://www.artfulsoftware.com/queries.php may help.