0

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

4
Contributors
4
Replies
5
Views
10 Years
Discussion Span
Last Post by debasisdas
0

Hi,

Try:

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

Regards,
Shrinivas

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.