On Mon, 28 Feb 2022 at 08:51, Cameron Simpson <c...@cskk.id.au> wrote:
>
> On 27Feb2022 11:16, Morten W. Petersen <morp...@gmail.com> wrote:
> >I was initially using the date object to get the right timespan, but
> >then
> >found that using the right timezone with that was a bit of a pain.  So I
> >went for the datetime object instead, specifying 0 on hour, minute and
> >second.
> >
> >What's the thinking behind this with the date object?  Wouldn't it be nice
> >to be able to specify a timezone?
>
> This has come up before. My own opinion is that no, it would be a bad
> idea. You're giving subday resolution to an object which is inherently
> "days". Leaving aside the many complications it brings (compare two
> dates, now requiring timezone context?) you've already hit on the easy
> and simple solution: datetimes.
>
> I'd even go so far as to suggest that if you needed a timezone for
> precision, then dates are the _wrong_ precision to work in.
>

I would agree. If you have timestamps and you're trying to determine
whether they're within a certain range, and timezones matter, then
your range is not days; it begins at a specific point in time and ends
at a specific point in time. Is that point midnight? 2AM? Start/close
of business? It could be anything, and I don't see a problem with
requiring that it be specified.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to