A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

time calculation



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2004, 09:41 PM
koko
external usenet poster
 
Posts: n/a
Default time calculation

hi,
could u pls help me to subtract one time value from another in visual basic?
i've tried using the datediff function but it doesn't give me the required results.
i've used the now function to generate two different system times and i want to subtract one from the other and display the time elasped. how do i go about it??
  #2  
Old April 29th, 2004, 10:22 PM
Ken Halter
external usenet poster
 
Posts: n/a
Default time calculation

koko wrote:

hi,
could u pls help me to subtract one time value from another in visual basic?
i've tried using the datediff function but it doesn't give me the required results.
i've used the now function to generate two different system times and i want to subtract one from the other and display the time elasped. how do i go about it??


Here's one that uses DateDiff to get what I think you're after...

Subject: Time Difference between two times in (HH:MM:SS) format
http://groups.google.com/groups?selm...&output=gplain

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
Please keep all discussions in the groups..
  #3  
Old April 30th, 2004, 07:11 AM
Doug Robbins - Word MVP
external usenet poster
 
Posts: n/a
Default time calculation

Hi Koko,

Do it like this:

Dim time1 As Date, time2 As Date, interval As Long
time1 = Format(Now, "HH:mm:ss")
MsgBox "Wait a while."
time2 = Format(Now, "HH:mm:ss")
interval = DateDiff("s", time1, time2)
MsgBox "The MessageBox was displayed from " & time1 & " until " & time2 & ".
an elapsed time of " & interval & " seconds."


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
"koko" wrote in message
...
hi,
could u pls help me to subtract one time value from another in visual

basic?
i've tried using the datediff function but it doesn't give me the required

results.
i've used the now function to generate two different system times and i

want to subtract one from the other and display the time elasped. how do i
go about it??

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:40 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.