ASP. NET uses the Subtract method to get the number of days between two dates

  • 2021-01-02 21:48:22
  • OfStack


DateTime startdate=DateTime.Parse("2013-11-01"); 
DateTime enddate = DateTime.Parse("2013-11-11"); 
int d = enddate.Subtract(startdate).Days;

Define the start time startdate

End time

Use method Subtract to get two time differences


Related articles: