Delphi 获取时间的年月日

Posted on 2011-07-26 09:12  严武  阅读(8117)  评论(0编辑  收藏  举报
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;

Copyright © 2024 严武
Powered by .NET 8.0 on Kubernetes