date today code example
Example 1: when is tuesday
Today
in a week
in two weeks
in a week x3
...
Example 2: datetime today
from datetime import datetime
# datetime object containing current date and time
now = datetime.now()
print("now =", now)
# dd/mm/YY H:M:S
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print("date and time =", dt_string)
Example 3: today's day of the year
from datetime import datetime
day_of_year = datetime.now().timetuple().tm_yday