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
https://ifso.iteye.com/blog/1752420
https://www.cnblogs.com/findumars/p/3821293.html