By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,491 Members | 879 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,491 IT Pros & Developers. It's quick & easy.

calculating difference between two times

P: n/a
Anyone know how to calculate the difference between two times
displayed in two textboxes?

I'm starting out with two textboxes: "txtCallTimeBegins" &
"txtCallTimeEnds"
this yielded: 6/7/2007 2:40:50 PM & 6/7/2007 2:45:04 PM respectively.

First I have coverted these to two additional textboxes to hold only
the time, not the date using:
=TimeValue([txtCallBeginTime]) & =TimeValue([txtCallEndTime])

So I end up with: 2:40:50 PM 2:45:04 PM txtConvertedBegin &
txtConvertedEnd textboxes

So I then want to get the difference of the two:
I tried =([txtConvertedEnd]-[txtConvertedBegin]) in another textbox
and get a .000991321321 (not the correct number) type of number which
I want to display as hh/mm/ss like 00:05:04 as the total call time.
I'm guessing I still need to store the decimal equivalent if I want to
do analysis of say the total time of calls for the week etc (?)

Thanks!

Jun 7 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jun 7, 2:12 pm, slinky <campbellbrian2...@yahoo.comwrote:
Anyone know how to calculate the difference between two times
displayed in two textboxes?

I'm starting out with two textboxes: "txtCallTimeBegins" &
"txtCallTimeEnds"
this yielded: 6/7/2007 2:40:50 PM & 6/7/2007 2:45:04 PM respectively.

First I have coverted these to two additional textboxes to hold only
the time, not the date using:
=TimeValue([txtCallBeginTime]) & =TimeValue([txtCallEndTime])

So I end up with: 2:40:50 PM 2:45:04 PM txtConvertedBegin &
txtConvertedEnd textboxes

So I then want to get the difference of the two:
I tried =([txtConvertedEnd]-[txtConvertedBegin]) in another textbox
and get a .000991321321 (not the correct number) type of number which
I want to display as hh/mm/ss like 00:05:04 as the total call time.
I'm guessing I still need to store the decimal equivalent if I want to
do analysis of say the total time of calls for the week etc (?)

Thanks!
See the VBA Help for the "DateDiff()" function...

Ron, King of Chi

Jun 7 '07 #2

P: n/a
slinky <ca***************@yahoo.comwrote in
news:11**********************@q75g2000hsh.googlegr oups.com:
Anyone know how to calculate the difference between two times
displayed in two textboxes?

I'm starting out with two textboxes: "txtCallTimeBegins" &
"txtCallTimeEnds"
this yielded: 6/7/2007 2:40:50 PM & 6/7/2007 2:45:04 PM
respectively.

First I have coverted these to two additional textboxes to
hold only the time, not the date using:
=TimeValue([txtCallBeginTime]) & =TimeValue([txtCallEndTime])

So I end up with: 2:40:50 PM 2:45:04 PM txtConvertedBegin &
txtConvertedEnd textboxes

So I then want to get the difference of the two:
I tried =([txtConvertedEnd]-[txtConvertedBegin]) in another
textbox and get a .000991321321 (not the correct number) type
of number which I want to display as hh/mm/ss like 00:05:04 as
the total call time. I'm guessing I still need to store the
decimal equivalent if I want to do analysis of say the total
time of calls for the week etc (?)

Thanks!
Actually, your .000991321321 is the correct difference between
the two times. (1 minute 26 seconds) It's just that it's shown
as the fraction of a day. You will want to remove your timevalue
functions, as the date is important if a call starts at 11:59 pm
and ends at two minutes after midnight.

As to showing .000991321321 in hh:mm:ss just use the format
function e.g. in the format property of the textbox that showed
you the number, put hh:nn:ss

--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Jun 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.