Generation

generate functionSat, 11 Feb 2023

calculate date in yyyy-mm-dd format for two years before from today

import datetime def date_calculator(year): today = datetime.datetime.today() end_date = today.replace(year=today.year - year) return end_date print(date_calculator(2))

Questions about programming?Chat with your personal AI assistant