Timezone for datetime.date objects

Morten W. Petersen morphex at gmail.com
Sun Mar 6 07:46:39 EST 2022


On Wed, Mar 2, 2022 at 6:20 PM Peter J. Holzer <hjp-python at hjp.at> wrote:

> 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.
>

Well, the precision we have is probably nowhere as close as it will be
possible
to specify in the future, so it depends on context.

But I agree on the train departing time, it should never be before the
scheduled time, and yes, probably peaks right after the departure time.

If I say I'll meet someone at 2 o'clock, that means 14:00, coming 5 minutes
early or late is acceptable.  So saying that implies a range in the given
context.

If I have a bill with a due date, it means I have to pay it on that date or
earlier
to do it correctly. Or even a couple of days later, if the due date is a
holiday
and it's not possible to make a bank transfer that day.

But with crypto currencies it is. :)

If I say I'll do something on the 15th of March, it would be reasonable to
think
that means between 06:00 and 21:00 on that day, but having it done at any
time that day would be correct.

So I think the correct interpretation depends on context, and if I say
14:02,
in a computer and programming context, that means 14:02:00 to 14:02:59,
because the seconds aren't specified, and 14:01 would not be a match, and
14:03 would also not be a match.

If I had specified in terms of seconds into that day

>>> (14*60*60)+(2*60)
50520

the implied and correct range would have been 50520.0 to 50520.99999.



>
> > 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.
>

Yeah, more or less what I'm saying above.

Regards,

Morten


-- 
I am https://leavingnorway.info
Videos at https://www.youtube.com/user/TheBlogologue
Twittering at http://twitter.com/blogologue
Blogging at http://blogologue.com
Playing music at https://soundcloud.com/morten-w-petersen
Also playing music and podcasting here:
http://www.mixcloud.com/morten-w-petersen/
On Google+ here https://plus.google.com/107781930037068750156
On Instagram at https://instagram.com/morphexx/


More information about the Python-list mailing list