TTimeEdit 24 hour format lazarus / 31-LCL ---------------------------------------------------------------------- Nevada Smith · 2017-03-25 11:02 I am using TTimeEdit in the implementation of a  countdown timer. TTimeEdit shows time in the hh:mm:ss AM format. How can I change it to 24 hour format, without AM/PM? Please advise. (LCL documentation and the internet does not seem to have anything in this regard. There are a few related to Delphi, but those options does not seem to work with LCL) ---------------------------------------------------------------------- jwdietrich · 2017-03-25 11:17 It's weird. On my computer, it is always in 24 hour format, event if I change the settings of the computer to a 12 hour format. I can't find any published properties that allow programmatic setting of the format, too. ---------------------------------------------------------------------- Thaddy · 2017-03-25 11:29 The timedit takes its format from formatsettings. ---------------------------------------------------------------------- jwdietrich · 2017-03-25 14:11 Quote from: Thaddy on March 25, 2017, 12:29:00 pmThe timedit takes its format from formatsettings. OK, but shouldn't the formatsettings be automatically updated on program launch? ---------------------------------------------------------------------- Thaddy · 2017-03-25 14:13 Yes, but you can clone formatsettings for your app and adapt it. But probably TTimedit needs a formatsettings field/property ---------------------------------------------------------------------- Bart · 2017-03-25 22:17 Given the way you can select time, I would have thought that text would always be in hh:nn format. Anyhow having a property of type TFormatSettings is a bit overkil. It could have a TimeFormat property though. Bart ---------------------------------------------------------------------- Bart · 2017-03-25 22:36 Quote from: jwdietrich on March 25, 2017, 03:11:32 pmOK, but shouldn't the formatsettings be automatically updated on program launch? On Windows it does AFAIK, on *nix you need to include the clocale unit somewhere (I think). Bart ---------------------------------------------------------------------- Nevada Smith · 2017-03-26 10:56 Thank you folks. I eventually moved on, and ended up using TDateTimePicker. ---------------------------------------------------------------------- Thonolan · 2024-02-22 13:59 I have found the settings to force the time settings. In sysutils unit. It sets a record on startup. with the Default formats from the Windows Regional settings. These can be over written by your own program. in your form1.create put the following two lines.  Sysutils.DefaultFormatSettings.LongTimeFormat:='hh:mm:ss';  Sysutils.DefaultFormatSettings.ShortTimeFormat:='hh:mm'; This will force TTimeEdit to use 24 hour settings. If your windows settings are already on 24 hour mode You will see no difference. The DefaultFormatSettings is reloaded from Windows on each run. ---------------------------------------------------------------------- Thaddy · 2024-02-22 15:35 Is the wrong approach. https://forum.lazarus.freepascal.org/index.php/topic,36311.msg241852.h tml#msg241852 Do what I told you. Do NOT modify the global settings. That goes for the other ill- informed answers as well: shame on you! ---------------------------------------------------------------------- wp · 2024-02-25 18:13 Just committed to Laz/main a change to TTimeEdit which introduces new TimeFormat and TimeSeparator properties. Now the formatting of the time edit control can be freely adjusted. TimeFormat, by default, is an empty string which means that the ShortTimeFormat value of the current DefaultFormatSettings is used. All format strings accepted by FormatDateTime can be entered except for those which contain a date part (d, y, m at the wrong place) (because the control is meant for time input only). TimeSeparator, by default, is also an empty string meaning that the TimeSeparator of the DefaultFormatSettings will be used. Only the first character of the value is used. The attached project demonstrates this new feature. Note that Laz/main is absolutely required to use the project. ---------------------------------------------------------------------- jamie · 2024-02-25 19:32 Nice fix, is it possible to place an example hint note in the OI at the bottom for the time format property? "Optional Text" hh:nn:ss:zz ? ---------------------------------------------------------------------- wp · 2024-02-25 21:09 Wait a bit. I guess dsiders will soon pick this up and write a help text - this is what appears at the bottom of the object inspector. But it will have to be more general than the specific example that I used in the demo. ---------------------------------------------------------------------- dsiders · 2024-02-26 00:23 Quote from: jamie on February 25, 2024, 08:32:59 pmNice fix, is it possible to place an example hint note in the OI at the bottom for the time format property? "Optional Text" hh:nn:ss:zz ? Not until there's documentation written for it. Edit Werner beat me to it...