Hello!
I have created a control using the TimeCtrl widget using this code to insert an hour in a 24h format using the HH:MM format

self.EndingHour = masked.TimeCtrl(panel, -1, name='24 hour control', format = 'HHMM', fmt24hr = True)

However, it keeps showing the time as a 12h clock (in the HH:MM format, so that's correct). How can I make it to show a 24H format?
Cheers!

Dani

Recommended Answers

All 2 Replies

format
This parameter can be used instead of the fmt24hr and displaySeconds parameters, respectively; it provides a shorthand way to specify the time format you want. Accepted values are 'HHMMSS', 'HHMM', '24HHMMSS', and '24HHMM'. If the format is specified, the other two arguments will be ignored.
fmt24hr
If True, control will display time in 24 hour time format; if False, it will use 12 hour AM/PM format. SetValue() will adjust values accordingly for the control, based on the format specified. (This value is ignored if the format parameter is specified.)

You can do

self.EndingHour = masked.TimeCtrl(panel, -1, name='24 hour control', format = '24HHMM')

or

self.EndingHour = masked.TimeCtrl(panel, -1, name='24 hour control', fmt24hr = True)

Cheers and Happy coding

Thank you! What a naive question :$
Cheers!

Dani

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.