find the current date in 00-month-year format in python

To get the current date in the given format, you can use the datetime module and the strftime() function to format the date string. Here is an example code snippet:

main.py
import datetime

today = datetime.datetime.today()
date_str = today.strftime('%d-%m-%Y')
print(date_str)
105 chars
6 lines

This will output the current date in the format DD-MM-YYYY, where DD is the day, MM is the month and YYYY is the year.

related categories

gistlibby LogSnag