如何将字符串日期时间转换为 UTC UNIX?
You're setting time zone to UTC when converting to datetime.转换为日期时间时,您将时区设置为 UTC。 But since your input represents time in Germany you want a time zone that is active there.但是由于您的输入代表德国的时间unix时间戳,您需要一个在那里有效的时区。 EX:前任:
Note that if the input represents the same time zone your OS is configured to use, this works correctly without setting a time zone.请注意,如果输入代表您的操作系统配置使用的同一时区,则无需设置时区即可正常工作。 But I think it's better to be explicit here, to avoid confusion if you eg run this script on a machine configured to use another time zone.但我认为最好在这里明确一点,以避免在您例如在配置为使用另一个时区的机器上运行此脚本时造成混淆。 (编辑:晋中站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |