Python Forum
Convert combobox user input in to date with tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert combobox user input in to date with tkinter
#2
from datetime import datetime

day, month, year = ('1', 'January', '2000')
mydate = datetime.strptime(f'{day} {month} {year}', '%d %B %Y')
print(mydate)
today = datetime.now()
print(today)
years = today.year - mydate.year
print(years)
Output:
2000-01-01 00:00:00 2020-06-29 22:21:04.644274 20
Reply


Messages In This Thread
RE: Convert combobox user input in to date with tkinter - by Yoriz - Jun-29-2020, 09:22 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGUI] [Solved]Help storing in user input from line edit Extra 2 1,846 May-12-2022, 07:46 PM
Last Post: Extra
  [PyQt] How can I sync Combobox index to other combobox index? nickzsche 2 2,467 Jan-03-2022, 12:29 PM
Last Post: Axel_Erfurt
  Convert tkinter to pyqt razs 6 5,925 Aug-29-2021, 11:08 AM
Last Post: razs
Question [Tkinter] Can I set background color for each item in tkinter Combobox? water 1 5,229 Dec-10-2020, 07:48 PM
Last Post: Larz60+
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 21,600 May-30-2020, 03:29 PM
Last Post: Larz60+
  Create an identification code from user input PeroPuri 1 1,949 Apr-11-2020, 11:56 AM
Last Post: Larz60+
  How can a user send a message via Contact Form in tkinter karolp 0 2,446 Apr-08-2020, 08:00 PM
Last Post: karolp
  [PyQt] Python PyQt5 - Change label text dynamically based on user Input ppel123 1 13,879 Mar-20-2020, 07:21 AM
Last Post: deanhystad
  [Tkinter] Tkinter delete combobox content and not the list LagratteCchouette 4 8,624 Dec-29-2019, 11:04 AM
Last Post: LagratteCchouette
  PyQt5: How do you set the user input of a line edit to a specific variable? YoshikageKira 17 12,029 Dec-26-2019, 03:18 PM
Last Post: Denni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020