TDateTimePicker使用时候,如果想获取到修改后的值,必须注Kind和time属性必须对应!
1,时间设置:
treatmentTime1DTPicker.Kind := dtkTime;
treatmentTime1DTPicker.Format := 'HH:mm';
treatmentTime1DTPicker.Time := now;
2,日期设置:
treatmentTime2DTPicker.Kind := dtkDate;
treatmentTime2DTPicker.Format := 'yyyy-mm-dd';
treatmentTime2DTPicker.Date := now;
得到上面两个控件的日期和时间
FormatDateTime('yyyy-mm-dd hh:mm:ss', Trunc(treatmentTime2DTPicker.Date) +Frac(treatmentTime1DTPicker.time));
参考:
https://www.cnblogs.com/hellochenchen/p/5438497.html