您的位置:首页 > 编程语言 > Delphi

Delphi 获取时间的年月日时分秒

2014-03-20 15:06 387 查看

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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: