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

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top