How to get the number of days between two date

  • Thread starter Thread starter ad
  • Start date Start date
A

ad

I have two DateTime variable dt1 and dt2.

How can I know the number of days between dt1 and dt2?
 
ad said:
I have two DateTime variable dt1 and dt2.

How can I know the number of days between dt1 and dt2?

(dt2-dt1).TotalDays

... subtracting two DateTimes gives you a TimeSpan, which you can call
TotalDays on.

hth,
Max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top