Python datetime today

In this Python datetime tutorial, you will learn how to find the Python datetime today.

# import datetime module
import datetime

# get current date
var_date = datetime.date.today()

# print the var_date
print("var_date =", var_date)

# print the type of var_date
print("type of var_date =", type(var_date))

Output:

var_date = 2022-09-20
type of var_date = <class 'datetime.date'>

Free resources to learn advanced skills: AiHints and CodeAllow