How to find date difference in C#
A date and time format string defines the text representation of a DateTime value that results from a formatting operation. In C# by calling any of the overloads of the DateTime constructor that allow you to specify specific elements of the date and time value like year , month or day.
Here newDate represents year as 2000 and month as May and date as 1 .
A calculation using a DateTime structure, such as Add or Subtract, does not modify the value of the structure. Instead, the calculation returns a new DateTime structure whose value is the result of the calculation. The DateTime.Subtract method may be used in order to find the date-time difference between two instances of the DateTime method.
You can also find the difference between two dates using the following method.
Convert String to DateTimeYou can use the methods like Convert.ToDateTime(String), DateTime.Parse() and DateTime.ParseExact() methods for converting a string-based date to a System.DateTime object. More about..... String to DateTime
DateTimePicker ControlThe most important property of the DateTimePicker is the Value property, which holds the selected date and time. More about..... DateTimePicker
Full Source C#