Count Time hours, minutes, seconds  
Author Message
Nancy3540





PostPosted: Tue Nov 14 20:28:24 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds

I would like to build up a counter that had a hour, minute, and second
display. Something like a command to start the timer and then a
command to stop the time then keep adding this time to a total time
and have a display that showed the time in live time while a user
types into a memo field. The idea is to add the time that a user types
into the memo field in order to keep track of how long they are
actually working. The start and stop is in case they have to answer
the phone while they are typing so as to not count this time until he
gets off the phone and starts working again. Is there anything out
there that I could copy.
TonySper

Exchange Server45  
 
 
Neil





PostPosted: Tue Nov 14 20:28:24 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds I code for a call center, but no way would I work on one. They want abandon
rates broken down to favourite biscuit and colour of underwear. If you get
moved onto Pod 5, the "Pod of Death", you're in serious trouble.

Anyway, you can use the DATETIME() function.

lnStart = DATETIME()
** do stuff
lnPeriod = DATETIME() - lnStart

lnPeriod gives the interval between current time and start time in seconds.
3600 secs in an hour, 60 secs in a min, and the INT() function and %
operator will help you roll your own function. Probably a much newer and
better way to do this, but think of the value of the mental excercise.

Might be better to store this value as seconds for your purposes anyway.

Cheers,
Neil




>I would like to build up a counter that had a hour, minute, and second
> display. Something like a command to start the timer and then a
> command to stop the time then keep adding this time to a total time
> and have a display that showed the time in live time while a user
> types into a memo field. The idea is to add the time that a user types
> into the memo field in order to keep track of how long they are
> actually working. The start and stop is in case they have to answer
> the phone while they are typing so as to not count this time until he
> gets off the phone and starts working again. Is there anything out
> there that I could copy.
> TonySper
>
>


 
 
TonySper





PostPosted: Wed Nov 15 12:44:38 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Neil.
Thanks for the insight. The start time end time and difference is not
the problem. The problem is in the ongoing display while they are
doing your do stuff between the start and stop. I guess some sort of a
do while routine while they are typing the keyboard or even when they
are not typing the keyboard. A time delay interrupt of some kind. I
just thought maybe someone has worked something like this out. I do
not know how to take care of this when the user is working in an edit
field on a form. Has to be some kind of routine that starts up and
runs while they are entering data into an edit field. Something like a
thermometer bar except it would be a digital display showing time.
TonySper



I code for a call center, but no way would I work on one. They want
abandon
rates broken down to favourite biscuit and colour of underwear. If you
get
moved onto Pod 5, the "Pod of Death", you're in serious trouble.

Anyway, you can use the DATETIME() function.

lnStart = DATETIME()
** do stuff
lnPeriod = DATETIME() - lnStart

lnPeriod gives the interval between current time and start time in
seconds.
3600 secs in an hour, 60 secs in a min, and the INT() function and %
operator will help you roll your own function. Probably a much newer
and
better way to do this, but think of the value of the mental excercise.

Might be better to store this value as seconds for your purposes
anyway.

Cheers,
Neil




>I would like to build up a counter that had a hour, minute, and
>second
> display. Something like a command to start the timer and then a
> command to stop the time then keep adding this time to a total time
> and have a display that showed the time in live time while a user
> types into a memo field. The idea is to add the time that a user
> types
> into the memo field in order to keep track of how long they are
> actually working. The start and stop is in case they have to answer
> the phone while they are typing so as to not count this time until
> he
> gets off the phone and starts working again. Is there anything out
> there that I could copy.
> TonySper
>
>



 
 
Jack





PostPosted: Wed Nov 15 14:11:05 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Look at the Timer object.

On Wed, 15 Nov 2006 13:44:48 -0500, "TonySper"


>Neil.
>Thanks for the insight. The start time end time and difference is not
>the problem. The problem is in the ongoing display while they are
>doing your do stuff between the start and stop. I guess some sort of a
>do while routine while they are typing the keyboard or even when they
>are not typing the keyboard. A time delay interrupt of some kind. I
>just thought maybe someone has worked something like this out. I do
>not know how to take care of this when the user is working in an edit
>field on a form. Has to be some kind of routine that starts up and
>runs while they are entering data into an edit field. Something like a
>thermometer bar except it would be a digital display showing time.
>TonySper
>


>I code for a call center, but no way would I work on one. They want
>abandon
>rates broken down to favourite biscuit and colour of underwear. If you
>get
>moved onto Pod 5, the "Pod of Death", you're in serious trouble.
>
>Anyway, you can use the DATETIME() function.
>
>lnStart = DATETIME()
>** do stuff
>lnPeriod = DATETIME() - lnStart
>
>lnPeriod gives the interval between current time and start time in
>seconds.
>3600 secs in an hour, 60 secs in a min, and the INT() function and %
>operator will help you roll your own function. Probably a much newer
>and
>better way to do this, but think of the value of the mental excercise.
>
>Might be better to store this value as seconds for your purposes
>anyway.
>
>Cheers,
>Neil
>
>


>>I would like to build up a counter that had a hour, minute, and
>>second
>> display. Something like a command to start the timer and then a
>> command to stop the time then keep adding this time to a total time
>> and have a display that showed the time in live time while a user
>> types into a memo field. The idea is to add the time that a user
>> types
>> into the memo field in order to keep track of how long they are
>> actually working. The start and stop is in case they have to answer
>> the phone while they are typing so as to not count this time until
>> he
>> gets off the phone and starts working again. Is there anything out
>> there that I could copy.
>> TonySper
>>
>>
>
>
 
 
TonySper





PostPosted: Thu Nov 16 11:36:53 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Jack,
I looked at the timer and have never used that object. Is there any
information somewhere that I can read how to use it?? Is there some
code I can look at to help me??
Tony



Look at the Timer object.

On Wed, 15 Nov 2006 13:44:48 -0500, "TonySper"


>Neil.
>Thanks for the insight. The start time end time and difference is not
>the problem. The problem is in the ongoing display while they are
>doing your do stuff between the start and stop. I guess some sort of
>a
>do while routine while they are typing the keyboard or even when they
>are not typing the keyboard. A time delay interrupt of some kind. I
>just thought maybe someone has worked something like this out. I do
>not know how to take care of this when the user is working in an edit
>field on a form. Has to be some kind of routine that starts up and
>runs while they are entering data into an edit field. Something like
>a
>thermometer bar except it would be a digital display showing time.
>TonySper
>


>I code for a call center, but no way would I work on one. They want
>abandon
>rates broken down to favourite biscuit and colour of underwear. If
>you
>get
>moved onto Pod 5, the "Pod of Death", you're in serious trouble.
>
>Anyway, you can use the DATETIME() function.
>
>lnStart = DATETIME()
>** do stuff
>lnPeriod = DATETIME() - lnStart
>
>lnPeriod gives the interval between current time and start time in
>seconds.
>3600 secs in an hour, 60 secs in a min, and the INT() function and %
>operator will help you roll your own function. Probably a much newer
>and
>better way to do this, but think of the value of the mental
>excercise.
>
>Might be better to store this value as seconds for your purposes
>anyway.
>
>Cheers,
>Neil
>
>


>>I would like to build up a counter that had a hour, minute, and
>>second
>> display. Something like a command to start the timer and then a
>> command to stop the time then keep adding this time to a total time
>> and have a display that showed the time in live time while a user
>> types into a memo field. The idea is to add the time that a user
>> types
>> into the memo field in order to keep track of how long they are
>> actually working. The start and stop is in case they have to answer
>> the phone while they are typing so as to not count this time until
>> he
>> gets off the phone and starts working again. Is there anything out
>> there that I could copy.
>> TonySper
>>
>>
>
>


 
 
Jack





PostPosted: Thu Nov 16 12:11:25 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds How about Help? Look at the topics under Timer Control, especially
the topic "Performing Specific Actions at Given Intervals".

On Thu, 16 Nov 2006 12:37:03 -0500, "TonySper"


>Jack,
>I looked at the timer and have never used that object. Is there any
>information somewhere that I can read how to use it?? Is there some
>code I can look at to help me??
>Tony
>


>Look at the Timer object.
>
>On Wed, 15 Nov 2006 13:44:48 -0500, "TonySper"

>
>>Neil.
>>Thanks for the insight. The start time end time and difference is not
>>the problem. The problem is in the ongoing display while they are
>>doing your do stuff between the start and stop. I guess some sort of
>>a
>>do while routine while they are typing the keyboard or even when they
>>are not typing the keyboard. A time delay interrupt of some kind. I
>>just thought maybe someone has worked something like this out. I do
>>not know how to take care of this when the user is working in an edit
>>field on a form. Has to be some kind of routine that starts up and
>>runs while they are entering data into an edit field. Something like
>>a
>>thermometer bar except it would be a digital display showing time.
>>TonySper
>>


>>I code for a call center, but no way would I work on one. They want
>>abandon
>>rates broken down to favourite biscuit and colour of underwear. If
>>you
>>get
>>moved onto Pod 5, the "Pod of Death", you're in serious trouble.
>>
>>Anyway, you can use the DATETIME() function.
>>
>>lnStart = DATETIME()
>>** do stuff
>>lnPeriod = DATETIME() - lnStart
>>
>>lnPeriod gives the interval between current time and start time in
>>seconds.
>>3600 secs in an hour, 60 secs in a min, and the INT() function and %
>>operator will help you roll your own function. Probably a much newer
>>and
>>better way to do this, but think of the value of the mental
>>excercise.
>>
>>Might be better to store this value as seconds for your purposes
>>anyway.
>>
>>Cheers,
>>Neil
>>
>>


>>>I would like to build up a counter that had a hour, minute, and
>>>second
>>> display. Something like a command to start the timer and then a
>>> command to stop the time then keep adding this time to a total time
>>> and have a display that showed the time in live time while a user
>>> types into a memo field. The idea is to add the time that a user
>>> types
>>> into the memo field in order to keep track of how long they are
>>> actually working. The start and stop is in case they have to answer
>>> the phone while they are typing so as to not count this time until
>>> he
>>> gets off the phone and starts working again. Is there anything out
>>> there that I could copy.
>>> TonySper
>>>
>>>
>>
>>
>
 
 
Olaf





PostPosted: Thu Nov 16 12:33:55 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds A Timer is there to do something after a
given Interval elapsed, not to measure time.

You might have an Interval of 1 Second
and a counter you'd increment at the Timer()
event to measure time, but isn't it much easier
to simply use DATETIME() at the start and
end of whatever you want the duration of?

Bye, Olaf.


 
 
Bernhard





PostPosted: Thu Nov 16 13:00:45 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Hi Olaf,

> A Timer is there to do something after a
> given Interval elapsed, not to measure time.
>
> You might have an Interval of 1 Second
> and a counter you'd increment at the Timer()
> event to measure time, but isn't it much easier
> to simply use DATETIME() at the start and
> end of whatever you want the duration of?

it is not only much easier, it is the only reliable way to measure time. As the
help tells, the value of the property .interval is only a guess for the elapsed
time between timer events. The really elapsed time depends on a lot of external
things that windows has to observe in the multi tasking environement.

Regards
Bernhard Sander
 
 
TonySper





PostPosted: Thu Nov 16 15:19:25 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Thank you all for the advice. Yes using the DateTime() is a great way
to measure the start and stop difference that's not the problem. What
I am trying to do is to display the time in a field and keep
incrementing it between the start DateTime() and stop DateTime(). I
would like to be able to use the timer to take snapshots of the
DATETIME() and display the difference until I stop the timer. I then
will end up with the total time difference between the start and stop
times. Something like what is on a lot of phones that shows how long
you have been on hold waiting for the party to get back to you after
they put you on hold and tell you how important your call is.
As Mr. Jackson suggested I am looking at the help "Performing Specific
Actions at Given Intervals" Now I have to understand what it is saying
and play with it.
I just thought maybe someone maybe has worked this out already as it
seems to me that it would be a useful procedure.
All the comments are gratefully accepted and thanks for all the help
this newsgroup has given me. If it were not for you all I would still
be coding in DOS (UGLY_UGLY)
Tony




A Timer is there to do something after a
given Interval elapsed, not to measure time.

You might have an Interval of 1 Second
and a counter you'd increment at the Timer()
event to measure time, but isn't it much easier
to simply use DATETIME() at the start and
end of whatever you want the duration of?

Bye, Olaf.



 
 
TonySper





PostPosted: Thu Nov 16 20:00:35 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Thanks for the pointers. Was able to get the timer to do what I
wanted. The tricky part is getting the seconds to minutes and the
minutes to hours. Subtracting the datetime() from datetime() always
gives you seconds. Dividing the seconds by 60 gives you fractions of
minutes, dividing minutes by 60 gives you fractions of hours which is
terrible to the user. Anyone have a quick conversion?
TonySper




Thank you all for the advice. Yes using the DateTime() is a great way
to measure the start and stop difference that's not the problem. What
I am trying to do is to display the time in a field and keep
incrementing it between the start DateTime() and stop DateTime(). I
would like to be able to use the timer to take snapshots of the
DATETIME() and display the difference until I stop the timer. I then
will end up with the total time difference between the start and stop
times. Something like what is on a lot of phones that shows how long
you have been on hold waiting for the party to get back to you after
they put you on hold and tell you how important your call is.
As Mr. Jackson suggested I am looking at the help "Performing Specific
Actions at Given Intervals" Now I have to understand what it is saying
and play with it.
I just thought maybe someone maybe has worked this out already as it
seems to me that it would be a useful procedure.
All the comments are gratefully accepted and thanks for all the help
this newsgroup has given me. If it were not for you all I would still
be coding in DOS (UGLY_UGLY)
Tony




A Timer is there to do something after a
given Interval elapsed, not to measure time.

You might have an Interval of 1 Second
and a counter you'd increment at the Timer()
event to measure time, but isn't it much easier
to simply use DATETIME() at the start and
end of whatever you want the duration of?

Bye, Olaf.




 
 
Jack





PostPosted: Thu Nov 16 21:56:36 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds It's just simple math.

nRem = dCurDateTime - dBeginDateTime

nDays = INT(nRem / (24 * 60 * 60))
nRem = nRem % (24 * 60 * 60)

nHours = INT(nRem / (60 * 60))
nRem = nRem % (60 * 60)

nMins = INT(nRem / 60)
nSecs = nRem % 60


On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"


>Thanks for the pointers. Was able to get the timer to do what I
>wanted. The tricky part is getting the seconds to minutes and the
>minutes to hours. Subtracting the datetime() from datetime() always
>gives you seconds. Dividing the seconds by 60 gives you fractions of
>minutes, dividing minutes by 60 gives you fractions of hours which is
>terrible to the user. Anyone have a quick conversion?
>TonySper
>
>


>Thank you all for the advice. Yes using the DateTime() is a great way
>to measure the start and stop difference that's not the problem. What
>I am trying to do is to display the time in a field and keep
>incrementing it between the start DateTime() and stop DateTime(). I
>would like to be able to use the timer to take snapshots of the
>DATETIME() and display the difference until I stop the timer. I then
>will end up with the total time difference between the start and stop
>times. Something like what is on a lot of phones that shows how long
>you have been on hold waiting for the party to get back to you after
>they put you on hold and tell you how important your call is.
>As Mr. Jackson suggested I am looking at the help "Performing Specific
>Actions at Given Intervals" Now I have to understand what it is saying
>and play with it.
>I just thought maybe someone maybe has worked this out already as it
>seems to me that it would be a useful procedure.
>All the comments are gratefully accepted and thanks for all the help
>this newsgroup has given me. If it were not for you all I would still
>be coding in DOS (UGLY_UGLY)
>Tony
>
>


>A Timer is there to do something after a
>given Interval elapsed, not to measure time.
>
>You might have an Interval of 1 Second
>and a counter you'd increment at the Timer()
>event to measure time, but isn't it much easier
>to simply use DATETIME() at the start and
>end of whatever you want the duration of?
>
>Bye, Olaf.
>
>
>
 
 
TonySper





PostPosted: Fri Nov 17 08:39:59 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Jack,
It may be simple to you but it looks very confusing to me. Thanks for
all the help and I think I will call this procedure "JacksonTimer".
Once I got into the timer as you suggested it took me about an hour to
work out the routine I needed. Now with your help I will work out the
subtractions. Thanks.
Tony



It's just simple math.

nRem = dCurDateTime - dBeginDateTime

nDays = INT(nRem / (24 * 60 * 60))
nRem = nRem % (24 * 60 * 60)

nHours = INT(nRem / (60 * 60))
nRem = nRem % (60 * 60)

nMins = INT(nRem / 60)
nSecs = nRem % 60


On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"


>Thanks for the pointers. Was able to get the timer to do what I
>wanted. The tricky part is getting the seconds to minutes and the
>minutes to hours. Subtracting the datetime() from datetime() always
>gives you seconds. Dividing the seconds by 60 gives you fractions of
>minutes, dividing minutes by 60 gives you fractions of hours which is
>terrible to the user. Anyone have a quick conversion?
>TonySper
>
>


>Thank you all for the advice. Yes using the DateTime() is a great way
>to measure the start and stop difference that's not the problem. What
>I am trying to do is to display the time in a field and keep
>incrementing it between the start DateTime() and stop DateTime(). I
>would like to be able to use the timer to take snapshots of the
>DATETIME() and display the difference until I stop the timer. I then
>will end up with the total time difference between the start and stop
>times. Something like what is on a lot of phones that shows how long
>you have been on hold waiting for the party to get back to you after
>they put you on hold and tell you how important your call is.
>As Mr. Jackson suggested I am looking at the help "Performing
>Specific
>Actions at Given Intervals" Now I have to understand what it is
>saying
>and play with it.
>I just thought maybe someone maybe has worked this out already as it
>seems to me that it would be a useful procedure.
>All the comments are gratefully accepted and thanks for all the help
>this newsgroup has given me. If it were not for you all I would still
>be coding in DOS (UGLY_UGLY)
>Tony
>
>


>A Timer is there to do something after a
>given Interval elapsed, not to measure time.
>
>You might have an Interval of 1 Second
>and a counter you'd increment at the Timer()
>event to measure time, but isn't it much easier
>to simply use DATETIME() at the start and
>end of whatever you want the duration of?
>
>Bye, Olaf.
>
>
>


 
 
AA





PostPosted: Fri Nov 17 11:17:23 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Here's another way. Given two datetime values ltDatetime1 and ltDateime2:

? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)

-Anders



> Jack,
> It may be simple to you but it looks very confusing to me. Thanks for
> all the help and I think I will call this procedure "JacksonTimer".
> Once I got into the timer as you suggested it took me about an hour to
> work out the routine I needed. Now with your help I will work out the
> subtractions. Thanks.
> Tony
>


> It's just simple math.
>
> nRem = dCurDateTime - dBeginDateTime
>
> nDays = INT(nRem / (24 * 60 * 60))
> nRem = nRem % (24 * 60 * 60)
>
> nHours = INT(nRem / (60 * 60))
> nRem = nRem % (60 * 60)
>
> nMins = INT(nRem / 60)
> nSecs = nRem % 60
>
>
> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>
>>Thanks for the pointers. Was able to get the timer to do what I
>>wanted. The tricky part is getting the seconds to minutes and the
>>minutes to hours. Subtracting the datetime() from datetime() always
>>gives you seconds. Dividing the seconds by 60 gives you fractions of
>>minutes, dividing minutes by 60 gives you fractions of hours which is
>>terrible to the user. Anyone have a quick conversion?
>>TonySper
>>
>>


>>Thank you all for the advice. Yes using the DateTime() is a great way
>>to measure the start and stop difference that's not the problem. What
>>I am trying to do is to display the time in a field and keep
>>incrementing it between the start DateTime() and stop DateTime(). I
>>would like to be able to use the timer to take snapshots of the
>>DATETIME() and display the difference until I stop the timer. I then
>>will end up with the total time difference between the start and stop
>>times. Something like what is on a lot of phones that shows how long
>>you have been on hold waiting for the party to get back to you after
>>they put you on hold and tell you how important your call is.
>>As Mr. Jackson suggested I am looking at the help "Performing
>>Specific
>>Actions at Given Intervals" Now I have to understand what it is
>>saying
>>and play with it.
>>I just thought maybe someone maybe has worked this out already as it
>>seems to me that it would be a useful procedure.
>>All the comments are gratefully accepted and thanks for all the help
>>this newsgroup has given me. If it were not for you all I would still
>>be coding in DOS (UGLY_UGLY)
>>Tony
>>
>>


>>A Timer is there to do something after a
>>given Interval elapsed, not to measure time.
>>
>>You might have an Interval of 1 Second
>>and a counter you'd increment at the Timer()
>>event to measure time, but isn't it much easier
>>to simply use DATETIME() at the start and
>>end of whatever you want the duration of?
>>
>>Bye, Olaf.
>>
>>
>>
>
>


 
 
TonySper





PostPosted: Fri Nov 17 14:07:54 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds That's great, saves a lot of putting together. Thanks.
Tony



Here's another way. Given two datetime values ltDatetime1 and
ltDateime2:

? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)

-Anders



> Jack,
> It may be simple to you but it looks very confusing to me. Thanks
> for
> all the help and I think I will call this procedure "JacksonTimer".
> Once I got into the timer as you suggested it took me about an hour
> to
> work out the routine I needed. Now with your help I will work out
> the
> subtractions. Thanks.
> Tony
>


> It's just simple math.
>
> nRem = dCurDateTime - dBeginDateTime
>
> nDays = INT(nRem / (24 * 60 * 60))
> nRem = nRem % (24 * 60 * 60)
>
> nHours = INT(nRem / (60 * 60))
> nRem = nRem % (60 * 60)
>
> nMins = INT(nRem / 60)
> nSecs = nRem % 60
>
>
> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>
>>Thanks for the pointers. Was able to get the timer to do what I
>>wanted. The tricky part is getting the seconds to minutes and the
>>minutes to hours. Subtracting the datetime() from datetime() always
>>gives you seconds. Dividing the seconds by 60 gives you fractions of
>>minutes, dividing minutes by 60 gives you fractions of hours which
>>is
>>terrible to the user. Anyone have a quick conversion?
>>TonySper
>>
>>


>>Thank you all for the advice. Yes using the DateTime() is a great
>>way
>>to measure the start and stop difference that's not the problem.
>>What
>>I am trying to do is to display the time in a field and keep
>>incrementing it between the start DateTime() and stop DateTime(). I
>>would like to be able to use the timer to take snapshots of the
>>DATETIME() and display the difference until I stop the timer. I then
>>will end up with the total time difference between the start and
>>stop
>>times. Something like what is on a lot of phones that shows how long
>>you have been on hold waiting for the party to get back to you after
>>they put you on hold and tell you how important your call is.
>>As Mr. Jackson suggested I am looking at the help "Performing
>>Specific
>>Actions at Given Intervals" Now I have to understand what it is
>>saying
>>and play with it.
>>I just thought maybe someone maybe has worked this out already as it
>>seems to me that it would be a useful procedure.
>>All the comments are gratefully accepted and thanks for all the help
>>this newsgroup has given me. If it were not for you all I would
>>still
>>be coding in DOS (UGLY_UGLY)
>>Tony
>>
>>


>>A Timer is there to do something after a
>>given Interval elapsed, not to measure time.
>>
>>You might have an Interval of 1 Second
>>and a counter you'd increment at the Timer()
>>event to measure time, but isn't it much easier
>>to simply use DATETIME() at the start and
>>end of whatever you want the duration of?
>>
>>Bye, Olaf.
>>
>>
>>
>
>



 
 
TonySper





PostPosted: Fri Nov 17 14:26:49 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Anders,
I must be doing something work. That formula does not give me the
correct answer. It keeps giving me a real way off number with a PM
after it. I wanted the difference in hours minutes and seconds between
the two!!
Tony




Here's another way. Given two datetime values ltDatetime1 and
ltDateime2:

? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)

-Anders



> Jack,
> It may be simple to you but it looks very confusing to me. Thanks
> for
> all the help and I think I will call this procedure "JacksonTimer".
> Once I got into the timer as you suggested it took me about an hour
> to
> work out the routine I needed. Now with your help I will work out
> the
> subtractions. Thanks.
> Tony
>


> It's just simple math.
>
> nRem = dCurDateTime - dBeginDateTime
>
> nDays = INT(nRem / (24 * 60 * 60))
> nRem = nRem % (24 * 60 * 60)
>
> nHours = INT(nRem / (60 * 60))
> nRem = nRem % (60 * 60)
>
> nMins = INT(nRem / 60)
> nSecs = nRem % 60
>
>
> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>
>>Thanks for the pointers. Was able to get the timer to do what I
>>wanted. The tricky part is getting the seconds to minutes and the
>>minutes to hours. Subtracting the datetime() from datetime() always
>>gives you seconds. Dividing the seconds by 60 gives you fractions of
>>minutes, dividing minutes by 60 gives you fractions of hours which
>>is
>>terrible to the user. Anyone have a quick conversion?
>>TonySper
>>
>>


>>Thank you all for the advice. Yes using the DateTime() is a great
>>way
>>to measure the start and stop difference that's not the problem.
>>What
>>I am trying to do is to display the time in a field and keep
>>incrementing it between the start DateTime() and stop DateTime(). I
>>would like to be able to use the timer to take snapshots of the
>>DATETIME() and display the difference until I stop the timer. I then
>>will end up with the total time difference between the start and
>>stop
>>times. Something like what is on a lot of phones that shows how long
>>you have been on hold waiting for the party to get back to you after
>>they put you on hold and tell you how important your call is.
>>As Mr. Jackson suggested I am looking at the help "Performing
>>Specific
>>Actions at Given Intervals" Now I have to understand what it is
>>saying
>>and play with it.
>>I just thought maybe someone maybe has worked this out already as it
>>seems to me that it would be a useful procedure.
>>All the comments are gratefully accepted and thanks for all the help
>>this newsgroup has given me. If it were not for you all I would
>>still
>>be coding in DOS (UGLY_UGLY)
>>Tony
>>
>>


>>A Timer is there to do something after a
>>given Interval elapsed, not to measure time.
>>
>>You might have an Interval of 1 Second
>>and a counter you'd increment at the Timer()
>>event to measure time, but isn't it much easier
>>to simply use DATETIME() at the start and
>>end of whatever you want the duration of?
>>
>>Bye, Olaf.
>>
>>
>>
>
>



 
 
AA





PostPosted: Fri Nov 17 17:49:53 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds SET HOURS TO 24
ltDatetime1=DATETIME(2006,1,1,10,10,10)
ltDatetime2=DATETIME(2006,1,1,5,5,5)
? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
18:54.55
18 hours on the 24-hour clock = 6 PM on the 12-hour clock

-Anders




> Anders,
> I must be doing something work. That formula does not give me the
> correct answer. It keeps giving me a real way off number with a PM
> after it. I wanted the difference in hours minutes and seconds between
> the two!!
> Tony
>
>


> Here's another way. Given two datetime values ltDatetime1 and
> ltDateime2:
>
> ? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
>
> -Anders
>


>> Jack,
>> It may be simple to you but it looks very confusing to me. Thanks
>> for
>> all the help and I think I will call this procedure "JacksonTimer".
>> Once I got into the timer as you suggested it took me about an hour
>> to
>> work out the routine I needed. Now with your help I will work out
>> the
>> subtractions. Thanks.
>> Tony
>>


>> It's just simple math.
>>
>> nRem = dCurDateTime - dBeginDateTime
>>
>> nDays = INT(nRem / (24 * 60 * 60))
>> nRem = nRem % (24 * 60 * 60)
>>
>> nHours = INT(nRem / (60 * 60))
>> nRem = nRem % (60 * 60)
>>
>> nMins = INT(nRem / 60)
>> nSecs = nRem % 60
>>
>>
>> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>>
>>>Thanks for the pointers. Was able to get the timer to do what I
>>>wanted. The tricky part is getting the seconds to minutes and the
>>>minutes to hours. Subtracting the datetime() from datetime() always
>>>gives you seconds. Dividing the seconds by 60 gives you fractions of
>>>minutes, dividing minutes by 60 gives you fractions of hours which
>>>is
>>>terrible to the user. Anyone have a quick conversion?
>>>TonySper
>>>
>>>


>>>Thank you all for the advice. Yes using the DateTime() is a great
>>>way
>>>to measure the start and stop difference that's not the problem.
>>>What
>>>I am trying to do is to display the time in a field and keep
>>>incrementing it between the start DateTime() and stop DateTime(). I
>>>would like to be able to use the timer to take snapshots of the
>>>DATETIME() and display the difference until I stop the timer. I then
>>>will end up with the total time difference between the start and
>>>stop
>>>times. Something like what is on a lot of phones that shows how long
>>>you have been on hold waiting for the party to get back to you after
>>>they put you on hold and tell you how important your call is.
>>>As Mr. Jackson suggested I am looking at the help "Performing
>>>Specific
>>>Actions at Given Intervals" Now I have to understand what it is
>>>saying
>>>and play with it.
>>>I just thought maybe someone maybe has worked this out already as it
>>>seems to me that it would be a useful procedure.
>>>All the comments are gratefully accepted and thanks for all the help
>>>this newsgroup has given me. If it were not for you all I would
>>>still
>>>be coding in DOS (UGLY_UGLY)
>>>Tony
>>>
>>>


>>>A Timer is there to do something after a
>>>given Interval elapsed, not to measure time.
>>>
>>>You might have an Interval of 1 Second
>>>and a counter you'd increment at the Timer()
>>>event to measure time, but isn't it much easier
>>>to simply use DATETIME() at the start and
>>>end of whatever you want the duration of?
>>>
>>>Bye, Olaf.
>>>
>>>
>>>
>>
>>
>
>
>

 
 
TonySper





PostPosted: Sat Nov 18 11:00:30 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds It appears you are subtracting Jan. 1, 2006 at 5:05:05 AM from Jan 1,
2006 at 10:10:10 AM and getting 6 PM ??
if I subtract the two I get 18305 seconds which is 5.0847 Hrs.???
Tony



SET HOURS TO 24
ltDatetime1=DATETIME(2006,1,1,10,10,10)
ltDatetime2=DATETIME(2006,1,1,5,5,5)
? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
18:54.55
18 hours on the 24-hour clock = 6 PM on the 12-hour clock

-Anders




> Anders,
> I must be doing something work. That formula does not give me the
> correct answer. It keeps giving me a real way off number with a PM
> after it. I wanted the difference in hours minutes and seconds
> between
> the two!!
> Tony
>
>


> Here's another way. Given two datetime values ltDatetime1 and
> ltDateime2:
>
> ? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
>
> -Anders
>


>> Jack,
>> It may be simple to you but it looks very confusing to me. Thanks
>> for
>> all the help and I think I will call this procedure "JacksonTimer".
>> Once I got into the timer as you suggested it took me about an hour
>> to
>> work out the routine I needed. Now with your help I will work out
>> the
>> subtractions. Thanks.
>> Tony
>>


>> It's just simple math.
>>
>> nRem = dCurDateTime - dBeginDateTime
>>
>> nDays = INT(nRem / (24 * 60 * 60))
>> nRem = nRem % (24 * 60 * 60)
>>
>> nHours = INT(nRem / (60 * 60))
>> nRem = nRem % (60 * 60)
>>
>> nMins = INT(nRem / 60)
>> nSecs = nRem % 60
>>
>>
>> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>>
>>>Thanks for the pointers. Was able to get the timer to do what I
>>>wanted. The tricky part is getting the seconds to minutes and the
>>>minutes to hours. Subtracting the datetime() from datetime() always
>>>gives you seconds. Dividing the seconds by 60 gives you fractions
>>>of
>>>minutes, dividing minutes by 60 gives you fractions of hours which
>>>is
>>>terrible to the user. Anyone have a quick conversion?
>>>TonySper
>>>
>>>


>>>Thank you all for the advice. Yes using the DateTime() is a great
>>>way
>>>to measure the start and stop difference that's not the problem.
>>>What
>>>I am trying to do is to display the time in a field and keep
>>>incrementing it between the start DateTime() and stop DateTime(). I
>>>would like to be able to use the timer to take snapshots of the
>>>DATETIME() and display the difference until I stop the timer. I
>>>then
>>>will end up with the total time difference between the start and
>>>stop
>>>times. Something like what is on a lot of phones that shows how
>>>long
>>>you have been on hold waiting for the party to get back to you
>>>after
>>>they put you on hold and tell you how important your call is.
>>>As Mr. Jackson suggested I am looking at the help "Performing
>>>Specific
>>>Actions at Given Intervals" Now I have to understand what it is
>>>saying
>>>and play with it.
>>>I just thought maybe someone maybe has worked this out already as
>>>it
>>>seems to me that it would be a useful procedure.
>>>All the comments are gratefully accepted and thanks for all the
>>>help
>>>this newsgroup has given me. If it were not for you all I would
>>>still
>>>be coding in DOS (UGLY_UGLY)
>>>Tony
>>>
>>>

>>>wrote

>>>A Timer is there to do something after a
>>>given Interval elapsed, not to measure time.
>>>
>>>You might have an Interval of 1 Second
>>>and a counter you'd increment at the Timer()
>>>event to measure time, but isn't it much easier
>>>to simply use DATETIME() at the start and
>>>end of whatever you want the duration of?
>>>
>>>Bye, Olaf.
>>>
>>>
>>>
>>
>>
>
>
>


 
 
Olaf





PostPosted: Sat Nov 18 15:02:55 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Hi Tony,

well, the result of 18:54.55 Anders gave is wrong,
but his code correctly outputs 05:05:05 for me.

This works, because TTOC(..,2) displays the
time portion of a datetime. he expression anders
uses simply adds the difference in seconds you
previously computed to the date().

What version of VFP are you using, if that
doesn't work for you?

Bye, Olaf.
 
 
Anders





PostPosted: Sat Nov 18 19:11:41 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Sorry Tony
I quoted the result from a wrong example which had the two times reversed.
You have to subtract the earlier time from the later.

SET HOURS TO 24
ltDatetime1=DATETIME(2006,1,1,10,10,10)
ltDatetime2=DATETIME(2006,1,1,5,5,5)
?
TTOC(DTOT(Date())+(MAX(ltDatetime1,ltDatetime2)-MIN(ltDatetime1,ltDatetime2)),2)

-Anders




> It appears you are subtracting Jan. 1, 2006 at 5:05:05 AM from Jan 1,
> 2006 at 10:10:10 AM and getting 6 PM ??
> if I subtract the two I get 18305 seconds which is 5.0847 Hrs.???
> Tony
>


> SET HOURS TO 24
> ltDatetime1=DATETIME(2006,1,1,10,10,10)
> ltDatetime2=DATETIME(2006,1,1,5,5,5)
> ? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
> 18:54.55
> 18 hours on the 24-hour clock = 6 PM on the 12-hour clock
>
> -Anders
>
>


>> Anders,
>> I must be doing something work. That formula does not give me the
>> correct answer. It keeps giving me a real way off number with a PM
>> after it. I wanted the difference in hours minutes and seconds
>> between
>> the two!!
>> Tony
>>
>>


>> Here's another way. Given two datetime values ltDatetime1 and
>> ltDateime2:
>>
>> ? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
>>
>> -Anders
>>


>>> Jack,
>>> It may be simple to you but it looks very confusing to me. Thanks
>>> for
>>> all the help and I think I will call this procedure "JacksonTimer".
>>> Once I got into the timer as you suggested it took me about an hour
>>> to
>>> work out the routine I needed. Now with your help I will work out
>>> the
>>> subtractions. Thanks.
>>> Tony
>>>


>>> It's just simple math.
>>>
>>> nRem = dCurDateTime - dBeginDateTime
>>>
>>> nDays = INT(nRem / (24 * 60 * 60))
>>> nRem = nRem % (24 * 60 * 60)
>>>
>>> nHours = INT(nRem / (60 * 60))
>>> nRem = nRem % (60 * 60)
>>>
>>> nMins = INT(nRem / 60)
>>> nSecs = nRem % 60
>>>
>>>
>>> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>>>
>>>>Thanks for the pointers. Was able to get the timer to do what I
>>>>wanted. The tricky part is getting the seconds to minutes and the
>>>>minutes to hours. Subtracting the datetime() from datetime() always
>>>>gives you seconds. Dividing the seconds by 60 gives you fractions
>>>>of
>>>>minutes, dividing minutes by 60 gives you fractions of hours which
>>>>is
>>>>terrible to the user. Anyone have a quick conversion?
>>>>TonySper
>>>>
>>>>


>>>>Thank you all for the advice. Yes using the DateTime() is a great
>>>>way
>>>>to measure the start and stop difference that's not the problem.
>>>>What
>>>>I am trying to do is to display the time in a field and keep
>>>>incrementing it between the start DateTime() and stop DateTime(). I
>>>>would like to be able to use the timer to take snapshots of the
>>>>DATETIME() and display the difference until I stop the timer. I
>>>>then
>>>>will end up with the total time difference between the start and
>>>>stop
>>>>times. Something like what is on a lot of phones that shows how
>>>>long
>>>>you have been on hold waiting for the party to get back to you
>>>>after
>>>>they put you on hold and tell you how important your call is.
>>>>As Mr. Jackson suggested I am looking at the help "Performing
>>>>Specific
>>>>Actions at Given Intervals" Now I have to understand what it is
>>>>saying
>>>>and play with it.
>>>>I just thought maybe someone maybe has worked this out already as
>>>>it
>>>>seems to me that it would be a useful procedure.
>>>>All the comments are gratefully accepted and thanks for all the
>>>>help
>>>>this newsgroup has given me. If it were not for you all I would
>>>>still
>>>>be coding in DOS (UGLY_UGLY)
>>>>Tony
>>>>
>>>>

>>>>wrote

>>>>A Timer is there to do something after a
>>>>given Interval elapsed, not to measure time.
>>>>
>>>>You might have an Interval of 1 Second
>>>>and a counter you'd increment at the Timer()
>>>>event to measure time, but isn't it much easier
>>>>to simply use DATETIME() at the start and
>>>>end of whatever you want the duration of?
>>>>
>>>>Bye, Olaf.
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>


 
 
TonySper





PostPosted: Sun Nov 19 13:02:38 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds No problem but this is different than the equation you gave me
earlier. You have added the +MAX and the -MIN which was not on the
first one. It looks like it will do the same thing.
Thanks for staying with me.
Tony




Sorry Tony
I quoted the result from a wrong example which had the two times
reversed.
You have to subtract the earlier time from the later.

SET HOURS TO 24
ltDatetime1=DATETIME(2006,1,1,10,10,10)
ltDatetime2=DATETIME(2006,1,1,5,5,5)
?
TTOC(DTOT(Date())+(MAX(ltDatetime1,ltDatetime2)-MIN(ltDatetime1,ltDatetime2)),2)

-Anders




> It appears you are subtracting Jan. 1, 2006 at 5:05:05 AM from Jan
> 1,
> 2006 at 10:10:10 AM and getting 6 PM ??
> if I subtract the two I get 18305 seconds which is 5.0847 Hrs.???
> Tony
>


> SET HOURS TO 24
> ltDatetime1=DATETIME(2006,1,1,10,10,10)
> ltDatetime2=DATETIME(2006,1,1,5,5,5)
> ? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
> 18:54.55
> 18 hours on the 24-hour clock = 6 PM on the 12-hour clock
>
> -Anders
>
>


>> Anders,
>> I must be doing something work. That formula does not give me the
>> correct answer. It keeps giving me a real way off number with a PM
>> after it. I wanted the difference in hours minutes and seconds
>> between
>> the two!!
>> Tony
>>
>>


>> Here's another way. Given two datetime values ltDatetime1 and
>> ltDateime2:
>>
>> ? TTOC(DTOT(Date())+(ltDatetime1-ltDatetime2),2)
>>
>> -Anders
>>


>>> Jack,
>>> It may be simple to you but it looks very confusing to me. Thanks
>>> for
>>> all the help and I think I will call this procedure
>>> "JacksonTimer".
>>> Once I got into the timer as you suggested it took me about an
>>> hour
>>> to
>>> work out the routine I needed. Now with your help I will work out
>>> the
>>> subtractions. Thanks.
>>> Tony
>>>


>>> It's just simple math.
>>>
>>> nRem = dCurDateTime - dBeginDateTime
>>>
>>> nDays = INT(nRem / (24 * 60 * 60))
>>> nRem = nRem % (24 * 60 * 60)
>>>
>>> nHours = INT(nRem / (60 * 60))
>>> nRem = nRem % (60 * 60)
>>>
>>> nMins = INT(nRem / 60)
>>> nSecs = nRem % 60
>>>
>>>
>>> On Thu, 16 Nov 2006 21:00:46 -0500, "TonySper"

>>>
>>>>Thanks for the pointers. Was able to get the timer to do what I
>>>>wanted. The tricky part is getting the seconds to minutes and the
>>>>minutes to hours. Subtracting the datetime() from datetime()
>>>>always
>>>>gives you seconds. Dividing the seconds by 60 gives you fractions
>>>>of
>>>>minutes, dividing minutes by 60 gives you fractions of hours which
>>>>is
>>>>terrible to the user. Anyone have a quick conversion?
>>>>TonySper
>>>>
>>>>


>>>>Thank you all for the advice. Yes using the DateTime() is a great
>>>>way
>>>>to measure the start and stop difference that's not the problem.
>>>>What
>>>>I am trying to do is to display the time in a field and keep
>>>>incrementing it between the start DateTime() and stop DateTime().
>>>>I
>>>>would like to be able to use the timer to take snapshots of the
>>>>DATETIME() and display the difference until I stop the timer. I
>>>>then
>>>>will end up with the total time difference between the start and
>>>>stop
>>>>times. Something like what is on a lot of phones that shows how
>>>>long
>>>>you have been on hold waiting for the party to get back to you
>>>>after
>>>>they put you on hold and tell you how important your call is.
>>>>As Mr. Jackson suggested I am looking at the help "Performing
>>>>Specific
>>>>Actions at Given Intervals" Now I have to understand what it is
>>>>saying
>>>>and play with it.
>>>>I just thought maybe someone maybe has worked this out already as
>>>>it
>>>>seems to me that it would be a useful procedure.
>>>>All the comments are gratefully accepted and thanks for all the
>>>>help
>>>>this newsgroup has given me. If it were not for you all I would
>>>>still
>>>>be coding in DOS (UGLY_UGLY)
>>>>Tony
>>>>
>>>>

>>>>wrote

>>>>A Timer is there to do something after a
>>>>given Interval elapsed, not to measure time.
>>>>
>>>>You might have an Interval of 1 Second
>>>>and a counter you'd increment at the Timer()
>>>>event to measure time, but isn't it much easier
>>>>to simply use DATETIME() at the start and
>>>>end of whatever you want the duration of?
>>>>
>>>>Bye, Olaf.
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>>
>
>



 
 
TonySper





PostPosted: Sun Nov 19 13:04:15 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Olaf,
Thanks for clearing up my mind. I am using VFP8.
Tony


"Olaf Doschke"


Hi Tony,

well, the result of 18:54.55 Anders gave is wrong,
but his code correctly outputs 05:05:05 for me.

This works, because TTOC(..,2) displays the
time portion of a datetime. he expression anders
uses simply adds the difference in seconds you
previously computed to the date().

What version of VFP are you using, if that
doesn't work for you?

Bye, Olaf.


 
 
Olaf





PostPosted: Mon Nov 20 07:28:07 CST 2006 Top

Exchange Servers >> Count Time hours, minutes, seconds Hi Tony,

> Thanks for clearing up my mind. I am using VFP8.
> Tony

Well, then TTOC(...,2) should work.

It's of course essential to subtract the
earlier Datetime() from the later one,
to get a positive difference, which added
to midnight gives the correct display
(for differences smaller than a day.)

Otherwise -5 hours, 5 minutes and 5
seconds will be displayed as 6:54:55 PM,
true.

Bye, Olaf.