Главная страница | назад





Article #28185: How to keep seconds from being included in the display when using TDateTimePicker

QUESTION:


How can you keep seconds from being included in the display when using TDateTimePicker?


ANSWER:


  • Note: This only applies when you have the TDateTimePicker Kind property set to dtkTime.

    Drop a TDateTimePicker component on your Form. Now add CommCtrl to the uses clause of your unit. Place the following code in the FormCreate event:

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    DateTime_SetFormat(DateTimePicker1.Handle,
    'hh:mm tt');
    end;
    


    For more formatting options, look up DateTime_SetFormat from the Microsoft Platform SDK.

    Last Modified: 02-JAN-02