I am trying to add to an if condition current year
DateTime nowDate = DateTime.Today;
if (ProgCMP != null && ProgCMP.ProgDate.Year == nowDate.Year)
{
HaveDataProg = true;
}
I know ProgCMP.ProgDate.Year is 2023, I got it listed from model but I failed getting the year of current date to make the comparison. What shoukld be the approach, please

Naimish MakwanaPosted Feb 4, 2023, 3:48 PM
Hello Marius,
The code you are using for the getting the year of current date is correct.
It is possible that the values of
ProgCMPorProgCMP.ProgDateare not what you expect,Or Please check and share what is the value of ProgCMP.ProgDate.Year.
Thanks
Naimish Makwana
Marius VasilePosted Feb 4, 2023, 3:52 PM
Thank you Naimish, you are correct, I checked it again, it was not the code it was other condition I was not noticing. I think I need a sleep :)