I. Use the DateDiff method to obtain the date and time intervals,
Ii. Code
Using System; using System. windows. forms; using Microsoft. visualBasic; namespace GetDateDiff {public partial class Frm_Main: Form {public Frm_Main () {InitializeComponent ();}/* Parameter Interval Type: Microsoft. visualBasic. dateInterval is required. The DateInterval enumerated value or String expression indicates the time interval between the units to be used as the difference between Date1 and Date2. Date1 type: required by System. DateTime. Date. The first Date/time value to be used in the calculation. Date2 type: required by System. DateTime. Date. The second Date/time value to be used in the calculation. DayOfWeek type: Microsoft. VisualBasic. FirstDayOfWeek is optional. The value selected from the FirstDayOfWeek enumeration to specify the first day of a week. If not specified, use FirstDayOfWeek. Sunday. WeekOfYear type: Microsoft. VisualBasic. FirstWeekOfYear is optional. The value selected from the FirstWeekOfYear enumeration to specify the first week of the year. If not specified, use FirstWeekOfYear. Jan1. Return Value Type: System. Int64 returns a Long value, which specifies the time interval between two Date values. */Private void btn_Get_Click (object sender, EventArgs e) {MessageBox. show ("interval" + DateAndTime. dateDiff (// use the DateDiff method to obtain the date interval DateInterval. day, dtpicker_first.Value, dtpicker_second.Value, FirstDayOfWeek. sunday, FirstWeekOfYear. jan1 ). toString () + "day", "interval ");}}}