if StrToInt(sY) > 2013 then
begin
bDate := False;
ShowMessage('Year is bigger than current year');
Exit;
end;
This is what I have at this stage but I'm pretty sure there is a way to get the current year instead of having to manually type it in delphi code, would be much appreciated if someone could help me with the code for it.
To get an only current year, use the JavaScript getFullYear() method. JavaScript date getFullYear() method returns the year of the specified date according to local time.
The getYear() method is used to get the year of a given date according to local time. The getYear() method returns the year minus 1900; thus: * For years above 2000, the value returned by getYear() is 100 or greater. For example, if the year is 2009, getYear() returns 109.
To get the current year, you can call the getFullYear() method will return the year of the specified Date according to local time.
JavaScript Date getFullYear() getFullYear() returns the full year (4 digits) of a date.
DateUtils.YearOf(Now)
will get you the current year,
or use
SysUtils.CurrentYear
.
As @Remy points out, Date
is more to the point than Now
. So is DateUtils.Today
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With