I want to change the "AM" to "PM" string and vice versa in Qt.
I created a QTimeEdit
in .ui and I set the displayFormat
to "HH::mm a"
but I always get AM even we're in afternoon now. How do I change the code to get a display either "AM" or "PM"?
I know that there's function members named amText()
and pmText()
, but they return a string.
The correct format string to get AM or PM depending on the actual time is
"ap"
. Thus, change your format string to"HH:mm ap"
.