Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何将 datatime.now 转换为仅日期?
from datetime import datetime, timedelta, time now = datetime.now() #2013-01-16 15:46:00.310499
我只需要日期,不需要时间
调用.date()它:
.date()
datetime.now().date()
或者只是使用date.today():
date.today()
from datetime import date date.today()