Navigation:  Appendices > Macro Language > Built-in Functions > All Functions (Alphabetical) >


Previous pageReturn to chapter overviewNext page

int = YearOf(nDate)


This macro function returns the year corresponding to nDate. The return values range from 1899 to about 2200. This function returns a four-digit year (eg. 1999).


If you have never heard of the Y2K bug and wish to use 2 digit dates, 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 updated on 01-Nov-2016.
Topic URL: