简体   繁体   English

python中EET/EEST的时间格式字符串是什么?

[英]What is the time format string for EET/EEST in python?

I am a python beginner and I have the timestap as following我是 python 初学者,我的时间戳如下

x:"Mon 20 Feb 2012 09:44:22 AM EET"
x:"Wed 27 Aug 2014 09:36:48 AM EEST"

I am wondering what is the format string for EET/EEST in pyhton?我想知道 pyhton 中 EET/EEST 的格式字符串是什么? I have already come up with : datetime.strptime(x, '%a %d %b %Y %I:%M:%S %p ??') .我已经想出了: datetime.strptime(x, '%a %d %b %Y %I:%M:%S %p ??') What should I put instead of ??我应该放什么而不是??

Thank you谢谢

It seems like this formatting works with UTC, but not other time zones (have tried EST, CST, IST)似乎这种格式适用于 UTC,但不适用于其他时区(已尝试过 EST、CST、IST)

So just write this like.所以就这样写吧。

>>timestamp = datetime.strptime('10/23/2019 6:02:05 PM EEST', '%m/%d/%Y %I:%M:%S %p EEST')

>>2019-10-23 06:02:05

This ignores the time zone and produces a time zone naive datetime, which will not error out (unless a time zone other than EST is input), but will also not pass the timestamp correctly because it is not passing the time zone这会忽略时区并产生一个时区天真的日期时间,它不会出错(除非输入了 EST 以外的时区),但也不会正确传递时间戳,因为它没有传递时区

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM