pythontkintertkcalendar

Is it possible to add time with date in DateEntry?


I'm using the following code for date. I need to add time with date. How can I do this?

ent_date_time = DateEntry(self.frame2, locale='en_US', date_pattern='y-mm-dd)

Solution

  • From what I've seen, it is not possible to get the current time using Tkinter's DateEntry.

    However you can use, the datetime.now() function to get the current date and time. Observe:

    >>> from datetime import datetime
    >>> print(datetime.now())
    2020-12-22 22:51:26.223754