2
Answers

Number of days and nights between two dates

Mehmet Fatih

Mehmet Fatih

1y
631
1

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)