python:module:datetime

datetime

常与time模块搭配

引入datetime:import datetime

print(datetime.date.today())
# 输出2023-12-27
str = "2023-12-27 12:00:00"
data = datetime.datetime.strptime(str, "%Y-%m-%d %H:%M:%S")
print(type(data))
# 输出<class 'datetime.datetime'>
  • python/module/datetime.txt
  • 最后更改: 2024/11/09 18:10
  • 127.0.0.1