WtForms DateTime 到 Python 日期时间
WxForms DateTime to Python DateTime
我需要从 WxWidget 转换 DateTime
Fri Sep 28 00:00:00 2018
另一种格式,例如:
28/09/18 20:35:00
但是我找不到任何事情可以做
使用wx.DateTime
格式()
即
d=wx.DateTime.Now()
d
<wx.DateTime: "Sat Sep 29 10:35:28 2018">
d.Format('%d/%m/%y %H:%M:%S')
'29/09/18 10:35:28'
有关格式选项,请参阅 datetime
手册页 https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
对于 wx.DateTime
选项,请参阅 https://wxpython.org/Phoenix/docs/html/wx.DateTime.html
要生成实际的 python 日期时间(根据您的问题标题):
f = d.Format('%d/%m/%y %H:%M:%S')
x = datetime.datetime.strptime(f,'%d/%m/%y %H:%M:%S')
x
datetime.datetime(2018, 9, 29, 10, 35, 28)
我需要从 WxWidget 转换 DateTime
Fri Sep 28 00:00:00 2018
另一种格式,例如:
28/09/18 20:35:00
但是我找不到任何事情可以做
使用wx.DateTime
格式()
即
d=wx.DateTime.Now()
d
<wx.DateTime: "Sat Sep 29 10:35:28 2018">
d.Format('%d/%m/%y %H:%M:%S')
'29/09/18 10:35:28'
有关格式选项,请参阅 datetime
手册页 https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
对于 wx.DateTime
选项,请参阅 https://wxpython.org/Phoenix/docs/html/wx.DateTime.html
要生成实际的 python 日期时间(根据您的问题标题):
f = d.Format('%d/%m/%y %H:%M:%S')
x = datetime.datetime.strptime(f,'%d/%m/%y %H:%M:%S')
x
datetime.datetime(2018, 9, 29, 10, 35, 28)