944,044 Members | Top Members by Rank

Ad:
Oct 10th, 2007
0

date problem

Expand Post »
Hi
I have placed two datepicker and one text box in the form one as dt1 and another as dt2 if I select say 12/12/2007 in dt1 and 28/12/2007 in dt2 then in text1.text the number of days elapsed between the two days should be appeared.
So will any one write the code for VB6.

thanks in advance
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
kehar is offline Offline
72 posts
since Sep 2007
Oct 10th, 2007
0

Re: date problem

Hi,

Try:

Text1.Text = DateDiff("d", DTPicker1.Value, DTPicker2.Value)

Regards,
Shrinivas
Reputation Points: 10
Solved Threads: 3
Light Poster
kshrini is offline Offline
45 posts
since Jun 2007
Oct 10th, 2007
0

Re: date problem

Hello Mr Shrinivas,
It is working but not as required by me. The code given by you gives 35 or 48 etc as the difference but I want it in days format like
if there is 35 days then it should show as 5/1/0 i.e one months five days I hope you got my point.

thanks
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
kehar is offline Offline
72 posts
since Sep 2007
Oct 11th, 2007
0

Re: date problem

You might want to re-think the way you are trying to express the number of days (days/months/years). It gives inconsistant results, depending on the beginning and ending dates.

For example, 5/1/0 is 35 days if the beginning date is 3/4/2007 and the ending date is 8/5/2007, but if the beginning date 3/5/2007 and the ending date is 8/6/2007, 5/1/0 is 36 days.

Hoppy
Reputation Points: 53
Solved Threads: 13
Junior Poster
hopalongcassidy is offline Offline
148 posts
since Oct 2007
Oct 12th, 2007
0

Re: date problem

its better write your own function for the purpose with all the formattings.
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: which grid should I use
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: running VB6 in background accepting keystokes and then controlling the mouse pointer





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC