This Python DateTime tutorial will teach you how to get the year from DateTime. You can find the year from DateTime using the following code:
# Import the datetime module import datetime # Get the current date and time date_time = datetime.datetime.now() # Get the year from the date and time year = date_time.year # Display the year print("Current year:", str(year))