I am trying to find the difference between two dates. The first of the two dates can be changed and when it is changed, the difference between the original dates has to be retained. This means that I have to automatically change the second date to have the same difference in days as it did before, but with a new first date.
Public Sub New()
InitializeComponent()
currDate = txt_ProjStart.Text
End Sub
Private Sub txt_ProjStart_TextChanged.....
If txt_ProjEnd.Text.Length > 0 Then
Dim newDate As Date
newDate = txt_ProjStart.Text
Dim endDate As Date
endDate = txt_ProjEnd.Text
End If
I have the value of the old date1(currDate) and the new date1 value(newDate). I need to get the difference between these, and then add or minus these days from the endDate.
Any help would be much appreciated! Thanks!
Dates and TimeSpans convert into each other automatically. In addition, it would be a good idea to use a safe date conversion.
TryParsewill not generate an exception, if the date is invalid. Rather it will returnFalse.