DateTime dtTime1 = dateTimePicker1.Value.Date; DateTime dtTime2 = dateTimePicker2.Value.Date; int iTotalDays = 0; if (dtTime1.Year == dtTime2.Year) { int iFirstMonth = dtTime1.DayOfYear; int iLastMonth = dtTime2.DayOfYear; if (iFirstMonth > iLastMonth) { iTotalDays = iFirstMonth - iLastMonth; } else { iTotalDays = iLastMonth - iFirstMonth; } }