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;
posted @ 2016-12-13 15:03  huanfuChen  阅读(4169)  评论(0编辑  收藏  举报