在jupyterlab和python depp中运行时,带有w/ w/ o时区的时间戳不一致
我试图了解Python中时区幼稚的日期的时间戳。我想TimeZone幼稚的日期时间可能具有与UTC DateTime具有相同数字的时间戳相同的时间戳。
首先,我在jupyterlab(pycharm)中对其进行测试:
它们具有相同的时间戳号码。
然后,我直接在Python解释器中对其进行测试:
发生的奇怪事情正在发生 - 时间戳现在为不同的!这次,没有时区的日期实际上是我的当地时间(澳大利亚/悉尼)。我在此处对其进行了验证:
这令人困惑。
- 为什么Jupyterlab和Python解释器有不同的 对此行为?
刚刚意识到我的jupyter在码头容器中运行,并且容器中的时区是UTC。
(base) root@2ddb91b80e47:~# date
Sun Jul 3 06:42:44 UTC 2022
- 什么时候应该是什么样的时间戳 为DateTime分配没有时区信息?
I'm trying to understand the timestamp of timezone naive datetime in Python. I guess the timezone naive datetime may has the same timestamp with the UTC datetime witht the same digits.
First I test it in jupyterlab (Pycharm):
They have the same timestamp number.
Then I test it in Python interpreter directly:
Strange things happening - the timestamps are now different! This time the datetime with no timezone is in fact my local time (Australia/Sydney). I verified it here:
This is confusing.
- Why do the Jupyterlab and Python interpreter have different
behaviours on this?
Just realized my jupyter is running in a docker container and the timezone in the container is UTC.
(base) root@2ddb91b80e47:~# date
Sun Jul 3 06:42:44 UTC 2022
- What kind of timestamp should it be when
assigning no timezone info for a datetime?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论