In this Python datetime tutorial, you will learn how to create a Python datetime object.
# import datetime module import datetime # create a datetime object var_date = datetime.datetime(2020, 4, 21, 12, 30, 45) # 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 = 2020-04-21 12:30:45 type of var_date = <class 'datetime.datetime'>
Free resources to learn advanced skills: AiHints and CodeAllow