473,569 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

This is hotel reservation when a departure date is changed manually by
user input ( to a valid date in date format - validity is
checkedsomewher e 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 txtADepartureDa te_KeyPress(ByV al sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles _
txtDepartureDat e.KeyPress

If txtDepartureDat e.Modified Then

If Not IsDate(txtDepar tureDate.Text) Then
txtDepartureDat e.Text = mdatDepartureDa te.ToString
Else
mdatDepartureDa te = CDate(txtDepart ureDate.Text)

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

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

End If ' txtDepartureDat e.Modified

End Sub

Oct 10 '06 #1
2 1492

DateTime.AddDay s(-1)

Amanda wrote:
This is hotel reservation when a departure date is changed manually by
user input ( to a valid date in date format - validity is
checkedsomewher e 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 txtADepartureDa te_KeyPress(ByV al sender As Object, _
ByVal e As System.Windows. Forms.KeyPressE ventArgs) Handles _
txtDepartureDat e.KeyPress

If txtDepartureDat e.Modified Then

If Not IsDate(txtDepar tureDate.Text) Then
txtDepartureDat e.Text = mdatDepartureDa te.ToString
Else
mdatDepartureDa te = CDate(txtDepart ureDate.Text)

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

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

End If ' txtDepartureDat e.Modified

End Sub
Oct 10 '06 #2

Truong Hong Thi wrote:
DateTime.AddDay s(-1)
Thanks

Oct 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
5721
by: Matt | last post by:
My ASP page allows the user select the date, and it will display the report during that week of that date. My question is when the program query database, I need to know the beginning date and ending date of that week. Any ideas??
8
3013
by: Dennis M. Marks | last post by:
What is the maximum valid date range for the date(yyyy,mm,dd) function. -- Dennis M. Marks http://www.dcs-chico.com/~denmarks/ Replace domain.invalid with dcsi.net -----= Posted via Newsfeeds.Com, Uncensored Usenet News =----- http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
7
13375
by: AdityaK | last post by:
Is there a way to find Weekend date for a given date using a DB2 query? I see that there are scalar functions such as DAY, DAYOFMONTH, DAYOFWEEK,etc are available...but couldn't find one to get a weekend date for any given date. Any information is appreciated. Thanks, Aditya.
5
40656
by: Hardy Wang | last post by:
Hi: Are there any algorithms I can use, that based on a given date and a culture code (different cultures may have different beginning of week), I can get first and last date of the current week? Thanks! --
1
4590
by: abcabcabc | last post by:
I write an application which can let user define own date format to input, How to convert the date string to date value with end-user defined date format? Example, User Defined Date Format as "dd/MM/yyyy" input as "01082003" convert to date value as, 01 Aug 2003 Example, User Defined Date Format as "yyyy,dd,MM"
4
39307
by: perryclisbee via AccessMonster.com | last post by:
I have dates of service for several people that range all over each month. ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I need to create a new field via a query that will convert each of the records of these service dates to the first date of that month, with results showing: 7/1/2006, 7/1/2006, 7/1/2006. How would...
4
14902
by: IsdWeb | last post by:
Hello, I am a newbie to coding and need some help. I am trying to figure out why the following code is not producing the correct Julian date. Any suggestions? Also, I am trying to understand the syntax liek what does DateAdd mean? If anyone can offer some good tutorials it would be appreciated as well. Thanks in advance.
4
2303
by: Tony B | last post by:
I'm looking to convert a string in "dd/MM/yy" format into a date object. How do I go about this ?
5
6546
OuTCasT
by: OuTCasT | last post by:
Hi. I would like to know how to convert the short date format to the long date format for my application without changing the regional settings from short date to long date. ?
2
2143
Soniad
by: Soniad | last post by:
Hi, In my website, I show commodity details on daily basis.These details are stored in one table for each day. I select record by matching current date and current date records are displayed.but there me cases when some day details are not updated. Hence, I need query where if current date record is not there then it should fetch records...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5513
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1221
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.