var CurrentDate: Date; EarlierDate: Date; begin CurrentDate := Today(); //12th of June, 2020 EarlierDate := DMY2Date(1, 1, 2020); //January 1st, 2020 Message(StrSubstNo('Date 1: %1 - Date 2: %2 - Subtracted: %3', CurrentDate, EarlierDate, CurrentDate - EarlierDate+1)); //Message = "Date 1: 12-06-20 - Date 2: 01-01-20 - Subtracted: 164"
Answers
You can just subtract a Date with January 1st of the relevant year from the date you're trying to find the number of.
If you compare with January 1st, you have to add 1 to the result, since it doesn't also count the day of January 1st. Or you can set the "EarlierDate" to 31st of December to the prior year.
RIS Plus, LLC
RIS Plus, LLC