Mastodon
Programmierung

DateTime: TDateTimePicker without seconds

> I am using the TDateTimePicker with Kind = dtkTime. I cannot seem to get
> rid of the seconds in the control. I just want my user to be able to set
> the hour & minutes. I have tried changing the longtimeformat to no avail.
>
> Any suggestions?

Try this (and please excuse any sloppy delphi code… C++ is my mother
tongue):

DateTimePicker1.Perform(DTM_SETFORMAT, 0, LPARAM(PChar(‘hh:mm’ )));

You can customize the control’s formatting by sending it the DTM_SETFORMAT
message with a formatting string as the LPARAM. Here’s a link to microsoft
documentation on the formatting string:
http://msdn.microsoft.com/library/psdk/shellcc/commctls/DateTime/DateTime.htm#dtp_format_chars

[tags]Delphi, Misc, DateTime[/tags]

0 Kommentare zu “DateTime: TDateTimePicker without seconds

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht.