Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
if StrToInt(sY) > 2013 then begin bDate := False; ShowMessage('Year is bigger than current year'); Exit; end;
这就是我现阶段所拥有的,但我很确定有一种方法可以获取当前年份,而不必在 delphi 代码中手动键入它,如果有人可以帮助我编写代码,我将不胜感激。
DateUtils.YearOf(Now)会给你当前的年份,
DateUtils.YearOf(Now)
或使用
SysUtils.CurrentYear.
SysUtils.CurrentYear
正如@Remy 指出的那样,Date比Now. 也是如此DateUtils.Today。
Date
Now
DateUtils.Today