📜  python datetime 的前一个月 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:38.132000             🧑  作者: Mango

代码示例1
import datetime
 today = datetime.date.today()
 first = today.replace(day=1)
 lastMonth = first - datetime.timedelta(days=1)
 print(lastMonth.strftime("%Y%m"))