In [1]: from dateutil.tz import tzoffset
In [2]: from datetime import datetime
In [3]: now = datetime.now(tzoffset('EDT', +4*60*60))
In [4]: print now.isoformat()
2016-05-28T01:43:14.702253+04:00
对于remove毫秒,使用类似的方法。在
^{pr2}$
删除毫秒的另一种方法
In [1]: now = datetime.now(tzoffset('EDT', +4*60*60)).replace(microsecond=0)
In [2]: print now.isoformat()
2016-05-28T01:43:14+04:00
试试这样的东西。使用
datetime
和dateutil
对于remove毫秒,使用类似的方法。在
^{pr2}$删除毫秒的另一种方法
相关问题 更多 >
编程相关推荐