I'm an apprentice.Please

Reply

Join Date: Nov 2006
Posts: 7
Reputation: Randika is an unknown quantity at this point 
Solved Threads: 0
Randika Randika is offline Offline
Newbie Poster

I'm an apprentice.Please

 
0
  #1
Apr 21st, 2007
I'm an aprentice to VB,but have a little knowledge and interested in doing experiments.
What i want to know is,how to get the time difference?
text1.text includes the 1st updated time and text2.text includes the 2nd updated time.text3.text must be the difference between two times.
please teach me to do this.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 181
Reputation: scudzilla is an unknown quantity at this point 
Solved Threads: 3
scudzilla's Avatar
scudzilla scudzilla is offline Offline
Junior Poster

Re: I'm an apprentice.Please

 
0
  #2
Apr 21st, 2007
Perhaps you can use Hour(Time), Minute(Time), and Second(Time) to get the hour, minute and second respectively for each of the two time points.
There are 10 types of people: those who understand Binary and those who don't!
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 186
Reputation: aparnesh is an unknown quantity at this point 
Solved Threads: 10
aparnesh's Avatar
aparnesh aparnesh is offline Offline
Junior Poster

Re: I'm an apprentice.Please

 
0
  #3
Apr 21st, 2007
Use the datediff function.

TimeDiff = DateDiff("n", Time1, Time2)

will give the time difference in minutes. For difference in seconds, use "s" instead of "n". Look up the datediff function in the Help files to see the syntax and various parameter options
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 16,153
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 530
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: I'm an apprentice.Please

 
0
  #4
Apr 21st, 2007
in vb you can get the current time by using now()
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 71
Reputation: venkatramasamy is an unknown quantity at this point 
Solved Threads: 12
venkatramasamy's Avatar
venkatramasamy venkatramasamy is offline Offline
Junior Poster in Training

Re: I'm an apprentice.Please

 
0
  #5
Oct 31st, 2007
HI

you need to set the Time Difff in text3 control right, then use the following code under any event

text3.text=DateDiff("n",cdate(text1.text),cdate(text2.text)

it is suggeted to check for the valid time entry by using the isdate function
Ex:
if isdate(text1.text)=false then
msgbox "Not Valid Time"

end if

hope this will help you,

regards
Venkatramasamy Sn
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
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC