I got a python script, which is supposed to fetch data of my mysql table (contains a date) and then it should print out the amount of days between today´s date and the date of my mysql table.
I already tried substracting the two dates, but this wouldn´t work. So I tried substracting today´s date and my birthday, which worked. So I think the problem is the mysql date.
import datetime import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", passwd="", database='appointments' ) eventDate = mydb.cursor() eventDate.execute('SELECT event_date FROM appointdatetitle') Date = eventDate.fetchall() tdelta = datetime.timedelta(days=7) today = datetime.date.today() eday = Date till_eday = eday - today print(till_eday.days)