Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Knowing how many days are between two dates

Status
Not open for further replies.

robman70

Technical User
Aug 6, 2002
90
0
0
Hello all,
i have a program with two text fields, txtCheckIn and txtCheckOut, a check in date is entered into txtCheckIn and a check out date is entered into txtCheckOut, then i get the information and put them into variables (both declared as date) what i want to know is how can i print days between, like if someone put 2/27/2003 in txtCheckIn and 3/2/2003 in txtCheckOut how can i make the program print
2/27/2003
2/28/2003
3/1/2003
3/2/2003

any help is appreciated
Thanks
 
dear robman
Try useing datediff() , you will find the difference between two dates
bye
Try it for me...
 
As srusti says, try investigating datediff. Then do a keyword search in this forum for any one of the many threads we've had on this topic; they discuss some of the failings of the datediff function, and explore ways to deal with them.
 

Dim dtCurrDate As Date
Dim dtStart As Date
Dim dtEnd As Date

dtStart = CDate(txtCheckIn.Text)
dtCurrDate = dtStart

Do
Debug.Print dtCurrDate
dtCurrDate = dtCurrDate + 1
Loop Until dtCurrDate=dtEnd
[/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top