1 from datetime import datetime 2 now = datetime.now() 3 print(now.strftime('%Y-%m-%d')) 4 print(now.strftime('%Y%m%d'))