2024-10-01 04:51:03 发布
网友
如何在Javascript上以new Date().toutstring()的形式获取python结果?在
在我制作的Javascript上:
new Date().toUTCString() "Tue, 08 Sep 2015 09:45:32 GMT"
在Python上
时间格式类似于RFC 2822 format (used in emails):
>>> import email.utils >>> email.utils.formatdate(usegmt=True) 'Tue, 08 Sep 2015 10:06:04 GMT'
或者,您可以使用^{}获得所需的任何时间格式:
其中^{} is defined here。在
import datetime date = datetime.datetime.utcnow().strftime("%c") print date # >>> 'Tue Sep 8 10:14:17 2015'`
试试这个。。在
from datetime import datetime date = datetime.utcnow().ctime() print date # >>> 'Tue Sep 8 10:10:22 2015'
时间格式类似于RFC 2822 format (used in emails):
或者,您可以使用^{} 获得所需的任何时间格式:
^{pr2}$其中^{} is defined here 。在
试试这个。。在
相关问题 更多 >
编程相关推荐