944,161 Members | Top Members by Rank

Ad:
Apr 21st, 2007
0

I'm an apprentice.Please

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Randika is offline Offline
7 posts
since Nov 2006
Apr 21st, 2007
0

Re: I'm an apprentice.Please

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.
Reputation Points: 26
Solved Threads: 5
Junior Poster
scudzilla is offline Offline
191 posts
since Mar 2007
Apr 21st, 2007
0

Re: I'm an apprentice.Please

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
Reputation Points: 20
Solved Threads: 10
Junior Poster
aparnesh is offline Offline
193 posts
since Jul 2005
Apr 21st, 2007
0

Re: I'm an apprentice.Please

in vb you can get the current time by using now()
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Oct 31st, 2007
0

Re: I'm an apprentice.Please

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
Reputation Points: 12
Solved Threads: 12
Junior Poster in Training
venkatramasamy is offline Offline
71 posts
since Aug 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: Marquee or Scrolling Text message in Statusbar using VB6
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: recordset,sql not sure where my problem is





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


Follow us on Twitter


© 2011 DaniWeb® LLC