我知道您可以使用該功能獲取當前日期和時間Now(),但是您如何獲取昨天的日期?
uj5u.com熱心網友回復:
為什么不直接使用Date - 1?
由于一天在TDateTime編碼中是1.0,因此減法1就足夠了。
uj5u.com熱心網友回復:
您可以使用以下Yesterday功能DateUtils:
uses DateUtils;
begin
ShowMessage('Yesterday = ' DateToStr(Yesterday)); // Date of yesterday
ShowMessage('Today = ' DateToStr(Date)); // Date of Today
ShowMessage('Tomorrow = ' DateToStr(tomorrow)); // Date of tomorrow
end;
這些函式回傳一個TDateTime資料型別。時間分量設定為零。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/433763.html
下一篇:delphi中給定年份的同一天
