My tkcalendar Entry is setting 2000 for years before 2000, example if you answer your bithdate is 1986 it consider you being born in 2086.
birthDateEntry = DateEntry(root, width=12,background='darkblue', foreground='white', borderwidth=2,font = ("Copperplate Gothic Light", 10))
student = Student(fullNameEntrada.get(), birthDateEntry.get_date().strftime("%m/%d/%Y").replace("-", "/"))
#For a 5/13/1989 it returns
print(birthDateEntry.get()) #Return 5/13/2089
print(birthDateEntry.get_date()) #Return 2089-05-13
#student class
class Student():
def __init__(self, name, birthdate):
self.name = name
self.birthdate = birthdate
self.age = self.getAge()
self.registerDate=str(date.today().strftime("%m/%d/%Y").replace("-", "/"))
self.connection = sqlite3.connect('students.db')
self.cursor = self.connection.cursor()
self.createTable()
#getAge Method on student class
def getAge(self):
today = date.today()
birthyear = self.birthdate.split()
self.age = today.year - int(birthyear[0][6:])
return self.age```
New contributor
Rodrigo Garcia Ramalho is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
Try it in this format datetime.today().strftime(‘%m-%d%-%Y’)