1
NobodyVe2x 2018-07-10 15:36:02 +08:00
参考:
#'Thu Mar 31 17:31:45 CST 2016' => 20160331173145 def convertdatastring(dstr): timestamp = time.mktime(time.strptime(dstr, '%a %b %d %H:%M:%S CST %Y')) result = datetime.datetime.fromtimestamp(int(timestamp)).strftime('%Y%m%d%H%M%S') return result 如果是反过来,直接 format 格式化啊! |
2
welkinzh 2018-07-10 15:59:04 +08:00
datetime.datetime.now().isoformat()
是这样吗 |