代码:

#encoding=utf-8
import datetime

d=datetime.datetime.today()
dateStr=d.strftime('%Y-%m-%d_%H:%M:%S')
print("Current time=",dateStr)

输出:

C:\hy\py>python 04-currentDatetime.py
Current time= 2022-01-25_20:42:17

END

相关文章:

  • 2022-12-23
  • 2022-02-06
  • 2021-05-19
  • 2021-11-28
  • 2021-11-28
  • 2021-11-23
  • 2021-08-12
  • 2022-12-23
猜你喜欢
  • 2021-05-22
  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-02-03
相关资源
相似解决方案