首页 > 解决方案 > 设置时区后 Google Colab 日期错误

问题描述

我一直在尝试设置 google colab 以使用今天从美国/东部时间设置的日期(我在美国西海岸,太平洋标准时间,这是一个额外的皱纹),这在东部时间晚上 7 点之后失败。我已经尝试了下面的代码,并在 2021 年 2 月 19 日返回 2021 年 2 月 20 日太平洋标准时间晚上 7 点(美国东部时间晚上 10 点)。

!rm /etc/localtime
!ln -s /usr/share/zoneinfo/US/Eastern /etc/localtime
!date

dateofinterest =  datetime.date.today()
print(dateofinterest)

关于如何让我的 colab 实例进入特定时区的任何想法或想法?

标签: pythondatetimetimezonegoogle-colaboratory

解决方案


推荐阅读