Delphi - TDateTimePicker使用注意问题


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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM