I don't think that is correct: Time intervals for days, etc always need
to be chosen so they are overlap free*, i.e. mathematically speaking the
interval is closed on one end and open on the other, with the start of
the next interval being the end of the last:
[t0,t1[ , [t1,t2[ , ...
For finite resolution (i.e. computers; assuming 3 didgits of millisecond
precision) and the example of 1 day as interval length, this would mean
that the interval of a day looks like:
[date 00:00:00.000, date 23:59:59.999]
or
[date 00:00:00.000, date+1 00:00:00.000[
To sum up:
1. I have used the convention to chose the start of the interval to be
closed, and the end to be open (i.e. t0 is in the interval, whereas
t1 is not), which I have encountered time and time again, and
therefore assume to be widely used.
2. Using midnight of the following day only makes sense if you invert
the open-closed end of the interval, which as I said to me is quite
unusal.
3. Using an application dependent time such as 21:00, 23:00, 01:00,
02:00 or 08:00 (because that is "when the backup runs or has
finished") is certainly something which no one can expect to be the
convention in a generally used language, and would imho be a
terrible idea (apart from the fact that there is no concept on how
to choose one over the other). It would also violate the sort order
of Date with DateTime, in the most unexpected way. Applications that
want/need that will have to use DateTime throughout.
4. As I have said, the only other implicit time I would consider
slightly viable is noon, but as far as least surprise, sort order
behavior, etc goes, using the start of the day is imho the singular
choice.
5. (Using 00:00:00.000 also follows the time honored IT convention of
"filling things up with zeroes", if not explicitly told differently
;-) )
Cheers,
mg
*Otherwise a point in time could be in more than one interval (e.g.
belong to more than one day).
On 18/11/2021 14:22, Jochen Theodorou wrote:
On 17.11.21 20:28, MG wrote:
[...]
3. I have never encountered any other assumption than the one that a
Date carries the implicit time of midnight (00:00:00.000...). What
other time would one logically pick, given that time intervals are
by convention typically closed on the left and open on the right ?
But you have here already trouble. you can take the start of the day, or
the end of the day. both is midnight, both based on the same date, but
they are basically 24h apart. In my last project we mostly used end of
the day for example. And in some parts actually 2:00 in the morning,
because it is the time to run after some processes... which did not
proof to be a good idea btw.
bye Jochen