Please enable JavaScript to view this site.


int = YearOf(nDate)


This macro function returns the 4-digit year of the date nDate.


This is the function used internally to evaluate the [yyyy] token.


If you wish to use 2 digit years, you have 2 solutions, depending if you want to get a number or a string :

nYear = YearOf(nDate)
sTwoDigit = StrCopy(IntToStr(nYear),3,2)  // string
nTwoDigit = nYear mod 100                 // number

See also: DayOf, WeekdayOf, WeekNumberOf, MonthOf, YearOf.


Topic 105067, last updated on 18-Apr-2020