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 Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

time calculation in visual basic



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

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:13 PM
Charlie Klatzkin
external usenet poster
 
Posts: n/a
Default time calculation in visual basic

Here is an example that works fine:
Option Explicit

Private Sub Form_Load()

Dim Date1 As Date, Date2 As Date

Date1 = Now()
Wait 2 'wait 2 seconds
Date2 = Now()

MsgBox DateDiff("s", Date1, Date2)

End Sub

Private Sub Wait(delay As Integer)

Dim r As Single

r = Timer
Do
DoEvents
Loop Until Timer r + delay

End Sub

"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 07:11 PM.


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