I use DateTimePicker component, Time mode. I want to set it's time format to 24 hour time format. How can I do this ?
//Uses Commctrl;
procedure TForm1.FormCreate(Sender: TObject);
begin
SendMessage(DateTimePicker1.Handle,DTM_SETFORMAT, 0,LongInt(PChar('HH:mm:ss')));
//The format strings are what Windows allows in the Regional
// Settings for Time - "HH" is military (24h time) and
//"hh" is 12 hour, adding "tt" to the end gets you the "am" / "pm", etc.
end;
//or with date and am/pm also:
procedure TForm1.Button1Click(Sender: TObject);
begin
SendMessage(DateTimePicker1.Handle,DTM_SETFORMAT, 0,LongInt(PChar('dd/MM/yyyy HH:mm:ss tt')));
end;
//Uses Commctrl;
procedure TForm1.FormCreate(Sender: TObject);
begin
SendMessage(DateTimePicker
//The format strings are what Windows allows in the Regional
// Settings for Time - "HH" is military (24h time) and
//"hh" is 12 hour, adding "tt" to the end gets you the "am" / "pm", etc.
end;
//or with date and am/pm also:
procedure TForm1.Button1Click(Sender
begin
SendMessage(DateTimePicker
end;
procedure TForm1.Button2Click(Sender
begin
Application.UpdateFormatSe
ShortTimeFormat := 'HH:mm:ss';
end;
sumber:http://www.experts-exchange.com/questions/10264999/24-Hour-format-for-Date-time-picker.html