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