The datetime module provides classes for manipulating dates and times in both simple and complex ways. Although date and time arithmetic is supported, the focus of the implementation is on efficiently extracting attributes for formatting and processing the output.
Let’s take a look at the sample code and try to understand it better.
# Python script to create an empty file
# with the current date as the name.
# import date and time module
# datetime.datetime.now () to get
# current date as filename.
datetime.datetime.no w ()
# create empty file
# The function creates an empty file
#% d - date,% B - month,% Y - year
"% d% B% Y"
01 August 2019.txt