将 zope DateTime 对象转换为 Python datetime 对象的最佳方法是什么?
我需要将 zope 2 DateTime 对象转换为 Python 日期时间对象。最好的方法是什么?谢谢,埃里卡
I need to convert a zope 2 DateTime object into a Python datetime object. What is the best way to do that? Thanks, Erika
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
较新的 DateTime 实现(2.11 及更高版本)有一个
asdatetime
方法,该方法返回 python datetime.datetime 实例:Newer DateTime implementations (2.11 and up) have a
asdatetime
method that returns a python datetime.datetime instance:datetime
实例是 timezone-naive 的;如果您需要支持时区(如 Zope2 的DateTime
那样),我推荐第三方扩展包 pytz 。The
datetime
instance is timezone-naive; if you need to support timezones (as Zope2'sDateTime
does), I recommend third-party extension package pytz.如果您的意思是 this
则相反
If you mean this one
then reverse is