pythonpyqtpyqt5qt-designerqdatetime

How to make QDateTimeEdit widget of qt designer in 24hr clock format


I am working on UI design which I am designing in qt desginer. In qt designer, there is a widget QDateTimeEdit through which we can select the date and time. I have added it and it looks like below:

enter image description here

I have added two widgets from start and end date time. I have also added calendar popup so for date, I can select using calendar. For time, I can adjust it by typing time on keyboard.

By default it comes with AM PM. Is there any way we can change this to 24hr clock format. ?


Solution

  • You have to set the format of the QDateTimeEdit in the displayFormat property:

    enter image description here