Do you want something like this?
DateTime date1 = new DateTime(2016, 10, 3);
DateTime date2 = new DateTime(2016, 11, 3);
var numberOfDays = date2.Subtract(date1).TotalDays;
More Related Contents:
- Specify Date format in MVC5 (dd/MM/yyyy)
- How do I get the correct time in C#
- Get the correct week number of a given date
- Change system date programmatically
- How to get client date and time in ASP.NET?
- How do I loop through a date range?
- A type for Date only in C# – why is there no Date type?
- Convert DateTime to Julian Date in C# (ToOADate Safe?)
- Difference between System.DateTime.Now and System.DateTime.Today
- Count number of Mondays in a given date range
- Datetime in C# add days
- Check if datetime instance falls in between other two datetime objects
- Random date in C#
- DateTime.Parse(“2012-09-30T23:00:00.0000000Z”) always converts to DateTimeKind.Local
- Javascript serialization of DateTime in asp.net is not giving a javascript date object?
- How can I calculate/find the week-number of a given date?
- Datetime format Issue: String was not recognized as a valid DateTime
- Convert string to datetime Using C#
- Can we convert an EXE into a program which can be Auto-Installed without any Clicks or Commands just after download, or may be on System Restart [closed]
- Error Message is not clear to me
- How to return a file (FileContentResult) in ASP.NET WebAPI
- How to compare DateTime in C#?
- How to get JSON response from a 3.5 asmx web service
- Programmatically close aspx page from code behind
- How to iterate through a DataTable
- How to hide a column (GridView) but still access its value?
- Getting current directory in .NET web application
- Type of conditional expression cannot be determined because there is no implicit conversion between ‘string’ and ‘System.DBNull’
- call async method without await #2
- Prevent timezone conversion on deserialization of DateTime value