date problem

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2007
Posts: 70
Reputation: kehar is an unknown quantity at this point 
Solved Threads: 0
kehar kehar is offline Offline
Junior Poster in Training

date problem

 
0
  #1
Oct 10th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 44
Reputation: kshrini is an unknown quantity at this point 
Solved Threads: 3
kshrini kshrini is offline Offline
Light Poster

Re: date problem

 
0
  #2
Oct 10th, 2007
Hi,

Try:

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

Regards,
Shrinivas
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 70
Reputation: kehar is an unknown quantity at this point 
Solved Threads: 0
kehar kehar is offline Offline
Junior Poster in Training

Re: date problem

 
0
  #3
Oct 10th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Oct 2007
Posts: 147
Reputation: hopalongcassidy is an unknown quantity at this point 
Solved Threads: 13
hopalongcassidy's Avatar
hopalongcassidy hopalongcassidy is offline Offline
Junior Poster

Re: date problem

 
0
  #4
Oct 11th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 2,149
Reputation: debasisdas will become famous soon enough debasisdas will become famous soon enough 
Solved Threads: 132
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Postaholic

Re: date problem

 
0
  #5
Oct 12th, 2007
its better write your own function for the purpose with all the formattings.
Share your Knowledge.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum


Views: 723 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC