TYZhang的答案正确 TDataTimePicker.Format:= 'yy/MM/dd'
(*
D7.CommCtrl.pas.6273
// Message constants
{$EXTERNALSYM DTM_FIRST}
DTM_FIRST = $1000;
{$EXTERNALSYM DTM_GETSYSTEMTIME}
DTM_GETSYSTEMTIME = DTM_FIRST + 1;
{$EXTERNALSYM DTM_SETSYSTEMTIME}
DTM_SETSYSTEMTIME = DTM_FIRST + 2;
{$EXTERNALSYM DTM_GETRANGE}
DTM_GETRANGE = DTM_FIRST + 3;
{$EXTERNALSYM DTM_SETRANGE}
DTM_SETRANGE = DTM_FIRST + 4;
{$EXTERNALSYM DTM_SETFORMATA}
DTM_SETFORMATA = DTM_FIRST + 5;
{$EXTERNALSYM DTM_SETMCCOLOR}
DTM_SETMCCOLOR = DTM_FIRST + 6;
{$EXTERNALSYM DTM_GETMCCOLOR}
DTM_GETMCCOLOR = DTM_FIRST + 7;
{$EXTERNALSYM DTM_GETMONTHCAL}
DTM_GETMONTHCAL = DTM_FIRST + 8;
{$EXTERNALSYM DTM_SETMCFONT}
DTM_SETMCFONT = DTM_FIRST + 9;
{$EXTERNALSYM DTM_GETMCFONT}
DTM_GETMCFONT = DTM_FIRST + 10;
{$EXTERNALSYM DTM_SETFORMATW}
DTM_SETFORMATW = DTM_FIRST + 50;
{$EXTERNALSYM DTM_SETFORMAT}
DTM_SETFORMAT = DTM_SETFORMATA;
*)
(*
D7.ComCtrls.pas.21661
procedure TDateTimePicker.SetFormat(const Value: String);
begin
if FFormat <> Value then
begin
FFormat := Value;
SendMessage(Handle, DTM_SETFORMAT, 0 , Integer(PChar(FFormat)));
end;
end;
*)
procedure SetDTPFormat(dtp: TDateTimePicker; Format: string);
const
D5_DTM_FIRST = $1000;
D5_DTM_SETFORMATA = D5_DTM_FIRST + 5;
D5_DTM_SETFORMAT = D5_DTM_SETFORMATA;
begin
SendMessage(dtp.Handle, D5_DTM_SETFORMAT, 0 , Integer(PChar(Format)));
end;
procedure InitDTP;
begin
SetDTPFormat(Form1.DateTimePicker1, 'yyDDmm');
end;