Mehmet Fatih

Mehmet Fatih

  • 858
  • 939
  • 41.1k

Number of days and nights between two dates

Jun 13 2023 8:18 PM

I want to calculate the numbers of days and nights between two dates. My date fields are in string types. I am trying to subtract like that but the sing "-" gives error. My code is like that.

(DateTime.Parse(dr["dtarihi"].ToString()).ToShortDateString()) - (DateTime.Parse(dr["dtarihi"].ToString()).ToShortDateString())


Answers (2)