Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting the year of the current date

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.

like image 201
user2879125 Avatar asked Oct 14 '13 18:10

user2879125


People also ask

How do I get current year only?

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.

How do you find the year of a Date object?

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.

How do I get the current year in HTML?

To get the current year, you can call the getFullYear() method will return the year of the specified Date according to local time.

How can we get the current year in JavaScript?

JavaScript Date getFullYear() getFullYear() returns the full year (4 digits) of a date.


1 Answers

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.

like image 172
LU RD Avatar answered Oct 03 '22 06:10

LU RD