Hacker News new | ask | show | jobs
by gonzus 1588 days ago
This is why experienced programmers will choose closed-open intervals by default -- they sidestep many of these pitfalls. For your example, you would do

  ... and date >= '2020-02-13' and date < '2020-02-14' -- notice: >= and <
Since this also applies to real numbers, maybe it is easier to keep in mind with an example in that realm. You would never check for a real number in a given range with:

  ... and X >= 3.0 and X <= 3.9 // or 3.99, or 3.999999
but instead, of course, you would do:

  ... and X >= 3.0 and X < 4