I needed this parameter to count the days until the date that I type for example (12/31/2016) as shown in the attached image, but it is returning only the number of days it was entered in the 31 day case and not the total days until that date which in the case would be 366 days. Can anyone give me any tips on how to do this count returning the total days until the date entered?
Note: The return of the number of days will be in a label (lblTotalDias.Text)
int iTotal = 0;
if (iDia < iMes)
{
iDia = 0;
iTotal++;
if (iDia < 30)
{
iDia++;
iTotal++;
if (iMes == 2 && ((iAno % 400 == 0)
|| (iAno % 4 == 0 && iAno % 100 != 0)) && iDia == 28)
{
iTotal++;
iDia = 31;
}
if (iMes == 2 && !((iAno % 400 == 0)
|| (iAno % 4 == 0 && iAno % 100 != 0)) && iDia == 27)
{
iTotal++;
iDia = 31;
}
if ((iMes == 1 || iMes == 3 || iMes == 5 || iMes == 7
|| iMes == 8 || iMes == 10 || iMes == 12) && iDia == 30)
{
iDia++;
iTotal++;
}
}
iMes++;
iTotal++;
}
iDia++;
iTotal++;
lblTotalDias.Text = (iDia - 1) + " DIAS";
}