How do I calculate the date of the previous day given a date ( in "MM/dd/yy" format)

  • Thread starter Thread starter Amanda
  • Start date Start date
A

Amanda

This is hotel reservation when a departure date is changed manually by
user input ( to a valid date in date format - validity is
checkedsomewhere else), the arrival date is set to the previous date
upon MouseLeave. How do I calculate the date of the previous day (see
mdatArrivalDate = ???? )?

(I have already done calculating departure date when an arrrivalDate is
modified manually - not via selecting on calendar - to valid data by
usind AddDay(1).)

Any help?



Private Sub txtADepartureDate_KeyPress(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles _
txtDepartureDate.KeyPress

If txtDepartureDate.Modified Then

If Not IsDate(txtDepartureDate.Text) Then
txtDepartureDate.Text = mdatDepartureDate.ToString
Else
mdatDepartureDate = CDate(txtDepartureDate.Text)

mdatArrivalDate = ???? (I need the date of previous day )

mshrNightStayed = 1
txtArrivalDate.Text = mdatArrivalDate.ToString
End If 'Not IsDate(txtDepartureDate.Text)

End If ' txtDepartureDate.Modified

End Sub
 
Back
Top