Timezone for datetime.date objects

Peter J. Holzer hjp-python at hjp.at
Wed Mar 2 12:17:54 EST 2022


On 2022-02-28 23:28:23 +0100, Morten W. Petersen wrote:
> Well, let's say I specify the datetime 2022-02-22 02:02 (AM). I think
> everyone could agree that it also means 2022-02-22 02:02:00:00, to
> 2022-02-22 02:02:59:59.

I disagree. The datetime 2022-02-22 02:02 specifies a point in time, not
a time period. It means 2022-02-22 02:02:00.000000000.....

In reality, a point in time may be fuzzy. "The train departs at 02:02"
definitely doesn't mean that the train will depart exactly at 02:02:00,
but it also doesn't mean that it will depart between 02:02 and 02:03.
Rather it's a smooth probability distribution starting a bit before
02:02:00 (a train should never leave early, but sometimes clocks are
wrong or somebody doesn't pay attention) a peak shortly after 02:02:00
and a very long tail.

> And I think the same applies for a date.

Depends on the context, but without s specific context (like business
days) I would agree. A day *is* a time period with a beginning and an
end. 

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp at hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://mail.python.org/pipermail/python-list/attachments/20220302/6b18a8a9/attachment.sig>


More information about the Python-list mailing list