Skip to content

Latest commit

 

History

History
17 lines (9 loc) · 275 Bytes

004-time.rst

File metadata and controls

17 lines (9 loc) · 275 Bytes

time

打印当前月份,去掉月份前的0,比如08月,就显示8月。

import time
print(re.findall(r'0*(.*)',time.strftime('%m'))[0])

打印当前日期时间,以年月日时分秒的格式

print(time.strftime('%Y-%m-%d %H:%M:%S'))