This Python DateTime tutorial will teach you how to add seconds to DateTime. In the following example, we will add 5 seconds to the current date and time.
Python
x
# Import the datetime module
import datetime
# Get the current date and time
date_time = datetime.datetime.now()
# Add 5 seconds to the date and time
date_time = date_time + datetime.timedelta(seconds=5)
# Display the date and time
print("Date and time after 5 seconds:", str(date_time))