Delphi 获取时间的年月日


procedure TFrmLltj.FormActivate(Sender: TObject);
var
   Present: TDateTime;
   Year, Month, Day, Hour, Min, Sec, MSec:Word;
begin
   Present:= Now;
   DecodeDate(Present, Year, Month, Day);
   DecodeTime(Present, Hour, Min, Sec, MSec);
   Showmessage(DateToStr(Present)+' '+TimeToStr(Present,'hh'));//显示年月日时分秒
   Showmessage(formatdatetime('hh:mm',time));//显示时分
   cbb_qs_n.Text := inttostr(Year);//显示年
   cbb_qs_y.Text := inttostr(Month);//显示月
   cbb_qs_r.Text := inttostr(Day);//显示日
   cbb_qs_s.Text := IntToStr(Hour);//显示时
   cbb_qs_f.Text := IntToStr(Min);//显示分


end;


免责声明!

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



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