Re: time calculation

From: Doug Robbins - Word MVP (dkr_at_NOmvpsSPAM.org)
Date: 04/30/04


Date: Fri, 30 Apr 2004 16:11:10 +1000

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" <anonymous@discussions.microsoft.com> wrote in message
news:8C806AFC-636D-4DC1-B5CF-C1C06CCACE28@microsoft.com...
> 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??


Relevant Pages

  • Re: cli/sti vs local_cmpxchg and local_add_return
    ... cycles_t time1, time2, time; ... static void do_test_sync_cmpxchg ...
    (Linux-Kernel)
  • Re: cli/sti vs local_cmpxchg and local_add_return
    ... cycles_t time1, time2, time; ... static void do_test_sync_cmpxchg ...
    (Linux-Kernel)
  • cli/sti vs local_cmpxchg and local_add_return
    ... cycles_t time1, time2, time; ... static void do_test_sync_cmpxchg ...
    (Linux-Kernel)
  • Re: time calculation
    ... Dim time1 As Date, time2 As Date, interval As Long ... > 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. ...
    (microsoft.public.word.newusers)
  • Re: time calculation
    ... Dim time1 As Date, time2 As Date, interval As Long ... > 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. ...
    (microsoft.public.vb.com)