PC Review


Reply
Thread Tools Rate Thread

Calculate Elasped time help

 
 
=?Utf-8?B?Sw==?=
Guest
Posts: n/a
 
      18th Apr 2006
Good day,

I would like to capture the elapsed time down to the second. So far I have
two fields. One is timeStart and one is timeEnd. For example:

I have a time recorded say start = 00:00 and end = 00:56 for one particular
observation. I can have up to 50 observations. The next observation would be
from Start = 00:56 to whatever the end.

I am basiclly performing time & motion studies. At the end of the
observations I would like to sum the totals into a total time value in
munutes seconds.

Any help would be greatly appreciated.

Thanks in advance.
 
Reply With Quote
 
 
 
 
Douglas J Steele
Guest
Posts: n/a
 
      18th Apr 2006
Don't use a Date type field to store durations: it isn't intended for that
purpose. Instead, use the DateDiff function to determine the number of
seconds between the two times (DateDiff("s", timeStart, timeEnd)) and simply
add uip the number of seconds. You may want to write a function that will
convert from total seconds to hh:mm:ss format:

Function FormatSeconds(DurationInSeconds As Long) As String
Dim lngHours As Long
Dim lngMinutes As Long
Dim lngSeconds As Long

lngHours = DurationInSeconds \ 3600
lngMinutes = DurationInSeconds Mod 3600
lngSeconds = lngMinutes Mod 60
lngMinutes = lngMinutes \ 60

FormatSeconds = lngHours & ":" & _
Format(lngMinutes, "00") & ":" & _
Format(lngSeconds, "00")

End Function

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"K" <(E-Mail Removed)> wrote in message
news:C9CA593D-3518-4046-97D8-(E-Mail Removed)...
> Good day,
>
> I would like to capture the elapsed time down to the second. So far I have
> two fields. One is timeStart and one is timeEnd. For example:
>
> I have a time recorded say start = 00:00 and end = 00:56 for one

particular
> observation. I can have up to 50 observations. The next observation would

be
> from Start = 00:56 to whatever the end.
>
> I am basiclly performing time & motion studies. At the end of the
> observations I would like to sum the totals into a total time value in
> munutes seconds.
>
> Any help would be greatly appreciated.
>
> Thanks in advance.



 
Reply With Quote
 
=?Utf-8?B?Sw==?=
Guest
Posts: n/a
 
      18th Apr 2006
Douglas,

Thank you for youre time in helping me. I am new with coding.

First where would I put the DateDiff ? I am assuming in the query that my
report is based on?
Second. where would I but the convert function? In the query to?

Thanks I really really appreciate this help.
"Douglas J Steele" wrote:

> Don't use a Date type field to store durations: it isn't intended for that
> purpose. Instead, use the DateDiff function to determine the number of
> seconds between the two times (DateDiff("s", timeStart, timeEnd)) and simply
> add uip the number of seconds. You may want to write a function that will
> convert from total seconds to hh:mm:ss format:
>
> Function FormatSeconds(DurationInSeconds As Long) As String
> Dim lngHours As Long
> Dim lngMinutes As Long
> Dim lngSeconds As Long
>
> lngHours = DurationInSeconds \ 3600
> lngMinutes = DurationInSeconds Mod 3600
> lngSeconds = lngMinutes Mod 60
> lngMinutes = lngMinutes \ 60
>
> FormatSeconds = lngHours & ":" & _
> Format(lngMinutes, "00") & ":" & _
> Format(lngSeconds, "00")
>
> End Function
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "K" <(E-Mail Removed)> wrote in message
> news:C9CA593D-3518-4046-97D8-(E-Mail Removed)...
> > Good day,
> >
> > I would like to capture the elapsed time down to the second. So far I have
> > two fields. One is timeStart and one is timeEnd. For example:
> >
> > I have a time recorded say start = 00:00 and end = 00:56 for one

> particular
> > observation. I can have up to 50 observations. The next observation would

> be
> > from Start = 00:56 to whatever the end.
> >
> > I am basiclly performing time & motion studies. At the end of the
> > observations I would like to sum the totals into a total time value in
> > munutes seconds.
> >
> > Any help would be greatly appreciated.
> >
> > Thanks in advance.

>
>
>

 
Reply With Quote
 
Douglas J Steele
Guest
Posts: n/a
 
      18th Apr 2006
My recommendation would be to use the DateDiff function in the query.

The FormatSeconds function would be put in a stand-alone module in your
application. Unless you've got queries that are doing summations for you,
there's no reason to use that function in your query.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"K" <(E-Mail Removed)> wrote in message
news:63F20D4F-BEF6-4E28-9CE6-(E-Mail Removed)...
> Douglas,
>
> Thank you for youre time in helping me. I am new with coding.
>
> First where would I put the DateDiff ? I am assuming in the query that my
> report is based on?
> Second. where would I but the convert function? In the query to?
>
> Thanks I really really appreciate this help.
> "Douglas J Steele" wrote:
>
> > Don't use a Date type field to store durations: it isn't intended for

that
> > purpose. Instead, use the DateDiff function to determine the number of
> > seconds between the two times (DateDiff("s", timeStart, timeEnd)) and

simply
> > add uip the number of seconds. You may want to write a function that

will
> > convert from total seconds to hh:mm:ss format:
> >
> > Function FormatSeconds(DurationInSeconds As Long) As String
> > Dim lngHours As Long
> > Dim lngMinutes As Long
> > Dim lngSeconds As Long
> >
> > lngHours = DurationInSeconds \ 3600
> > lngMinutes = DurationInSeconds Mod 3600
> > lngSeconds = lngMinutes Mod 60
> > lngMinutes = lngMinutes \ 60
> >
> > FormatSeconds = lngHours & ":" & _
> > Format(lngMinutes, "00") & ":" & _
> > Format(lngSeconds, "00")
> >
> > End Function
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> > "K" <(E-Mail Removed)> wrote in message
> > news:C9CA593D-3518-4046-97D8-(E-Mail Removed)...
> > > Good day,
> > >
> > > I would like to capture the elapsed time down to the second. So far I

have
> > > two fields. One is timeStart and one is timeEnd. For example:
> > >
> > > I have a time recorded say start = 00:00 and end = 00:56 for one

> > particular
> > > observation. I can have up to 50 observations. The next observation

would
> > be
> > > from Start = 00:56 to whatever the end.
> > >
> > > I am basiclly performing time & motion studies. At the end of the
> > > observations I would like to sum the totals into a total time value in
> > > munutes seconds.
> > >
> > > Any help would be greatly appreciated.
> > >
> > > Thanks in advance.

> >
> >
> >



 
Reply With Quote
 
=?Utf-8?B?Sw==?=
Guest
Posts: n/a
 
      18th Apr 2006
Hi Doug, I am not avhieving what I am trying to do. Not sure if it is the way
I have it set-up. So I am going to go throught it simply as I can and
hopefully I can be helped or clarified on this. So, I have two fields as
follows in my subform:

Name Data Type Format
Time_Start Date / Time Number
Time_End Date / Time Number

This is so I can enter my stop watch values as 0 for time start and for
example as a my time_end = 1.26 which would be 1 minute and 25 seconds. My
elapsed time would therefore be 85 Seconds total.

Is this possible to achieve an elapsed time?



"Douglas J Steele" wrote:

> My recommendation would be to use the DateDiff function in the query.
>
> The FormatSeconds function would be put in a stand-alone module in your
> application. Unless you've got queries that are doing summations for you,
> there's no reason to use that function in your query.
>
> --
> Doug Steele, Microsoft Access MVP
> http://I.Am/DougSteele
> (no e-mails, please!)
>
>
> "K" <(E-Mail Removed)> wrote in message
> news:63F20D4F-BEF6-4E28-9CE6-(E-Mail Removed)...
> > Douglas,
> >
> > Thank you for youre time in helping me. I am new with coding.
> >
> > First where would I put the DateDiff ? I am assuming in the query that my
> > report is based on?
> > Second. where would I but the convert function? In the query to?
> >
> > Thanks I really really appreciate this help.
> > "Douglas J Steele" wrote:
> >
> > > Don't use a Date type field to store durations: it isn't intended for

> that
> > > purpose. Instead, use the DateDiff function to determine the number of
> > > seconds between the two times (DateDiff("s", timeStart, timeEnd)) and

> simply
> > > add uip the number of seconds. You may want to write a function that

> will
> > > convert from total seconds to hh:mm:ss format:
> > >
> > > Function FormatSeconds(DurationInSeconds As Long) As String
> > > Dim lngHours As Long
> > > Dim lngMinutes As Long
> > > Dim lngSeconds As Long
> > >
> > > lngHours = DurationInSeconds \ 3600
> > > lngMinutes = DurationInSeconds Mod 3600
> > > lngSeconds = lngMinutes Mod 60
> > > lngMinutes = lngMinutes \ 60
> > >
> > > FormatSeconds = lngHours & ":" & _
> > > Format(lngMinutes, "00") & ":" & _
> > > Format(lngSeconds, "00")
> > >
> > > End Function
> > >
> > > --
> > > Doug Steele, Microsoft Access MVP
> > > http://I.Am/DougSteele
> > > (no e-mails, please!)
> > >
> > >
> > > "K" <(E-Mail Removed)> wrote in message
> > > news:C9CA593D-3518-4046-97D8-(E-Mail Removed)...
> > > > Good day,
> > > >
> > > > I would like to capture the elapsed time down to the second. So far I

> have
> > > > two fields. One is timeStart and one is timeEnd. For example:
> > > >
> > > > I have a time recorded say start = 00:00 and end = 00:56 for one
> > > particular
> > > > observation. I can have up to 50 observations. The next observation

> would
> > > be
> > > > from Start = 00:56 to whatever the end.
> > > >
> > > > I am basiclly performing time & motion studies. At the end of the
> > > > observations I would like to sum the totals into a total time value in
> > > > munutes seconds.
> > > >
> > > > Any help would be greatly appreciated.
> > > >
> > > > Thanks in advance.
> > >
> > >
> > >

>
>
>

 
Reply With Quote
 
Douglas J Steele
Guest
Posts: n/a
 
      18th Apr 2006
Are you saying that you're actually entering 1.26 for Time_End? If so, your
Data Types shouldn't be Date/Time: a value of 1.26 for a date/time field
corresponds to 6:14:24 AM on 31 Dec, 1899.

You're going to need a function to convert from 1.25 to 85. Something like
the following untested air code, perhaps:

Function ConvertMinutesSeconds(Time_Value As Single) As Long

ConvertMinutesSeconds = Int(Time_Value) * 60 + _
(Time_Value - Int(Time_Value)) * 100

End Function

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"K" <(E-Mail Removed)> wrote in message
news:CC7B465D-A703-44C3-AB67-(E-Mail Removed)...
> Hi Doug, I am not avhieving what I am trying to do. Not sure if it is the

way
> I have it set-up. So I am going to go throught it simply as I can and
> hopefully I can be helped or clarified on this. So, I have two fields as
> follows in my subform:
>
> Name Data Type Format
> Time_Start Date / Time Number
> Time_End Date / Time Number
>
> This is so I can enter my stop watch values as 0 for time start and for
> example as a my time_end = 1.26 which would be 1 minute and 25 seconds. My
> elapsed time would therefore be 85 Seconds total.
>
> Is this possible to achieve an elapsed time?
>
>
>
> "Douglas J Steele" wrote:
>
> > My recommendation would be to use the DateDiff function in the query.
> >
> > The FormatSeconds function would be put in a stand-alone module in your
> > application. Unless you've got queries that are doing summations for

you,
> > there's no reason to use that function in your query.
> >
> > --
> > Doug Steele, Microsoft Access MVP
> > http://I.Am/DougSteele
> > (no e-mails, please!)
> >
> >
> > "K" <(E-Mail Removed)> wrote in message
> > news:63F20D4F-BEF6-4E28-9CE6-(E-Mail Removed)...
> > > Douglas,
> > >
> > > Thank you for youre time in helping me. I am new with coding.
> > >
> > > First where would I put the DateDiff ? I am assuming in the query that

my
> > > report is based on?
> > > Second. where would I but the convert function? In the query to?
> > >
> > > Thanks I really really appreciate this help.
> > > "Douglas J Steele" wrote:
> > >
> > > > Don't use a Date type field to store durations: it isn't intended

for
> > that
> > > > purpose. Instead, use the DateDiff function to determine the number

of
> > > > seconds between the two times (DateDiff("s", timeStart, timeEnd))

and
> > simply
> > > > add uip the number of seconds. You may want to write a function that

> > will
> > > > convert from total seconds to hh:mm:ss format:
> > > >
> > > > Function FormatSeconds(DurationInSeconds As Long) As String
> > > > Dim lngHours As Long
> > > > Dim lngMinutes As Long
> > > > Dim lngSeconds As Long
> > > >
> > > > lngHours = DurationInSeconds \ 3600
> > > > lngMinutes = DurationInSeconds Mod 3600
> > > > lngSeconds = lngMinutes Mod 60
> > > > lngMinutes = lngMinutes \ 60
> > > >
> > > > FormatSeconds = lngHours & ":" & _
> > > > Format(lngMinutes, "00") & ":" & _
> > > > Format(lngSeconds, "00")
> > > >
> > > > End Function
> > > >
> > > > --
> > > > Doug Steele, Microsoft Access MVP
> > > > http://I.Am/DougSteele
> > > > (no e-mails, please!)
> > > >
> > > >
> > > > "K" <(E-Mail Removed)> wrote in message
> > > > news:C9CA593D-3518-4046-97D8-(E-Mail Removed)...
> > > > > Good day,
> > > > >
> > > > > I would like to capture the elapsed time down to the second. So

far I
> > have
> > > > > two fields. One is timeStart and one is timeEnd. For example:
> > > > >
> > > > > I have a time recorded say start = 00:00 and end = 00:56 for one
> > > > particular
> > > > > observation. I can have up to 50 observations. The next

observation
> > would
> > > > be
> > > > > from Start = 00:56 to whatever the end.
> > > > >
> > > > > I am basiclly performing time & motion studies. At the end of the
> > > > > observations I would like to sum the totals into a total time

value in
> > > > > munutes seconds.
> > > > >
> > > > > Any help would be greatly appreciated.
> > > > >
> > > > > Thanks in advance.
> > > >
> > > >
> > > >

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do calculate elasped time Nolan Holloway Microsoft Excel Worksheet Functions 2 5th Jun 2009 09:16 PM
Re: how do calculate elasped time Bernard Liengme Microsoft Excel Worksheet Functions 0 5th Jun 2009 08:16 PM
Calculate elasped time =?Utf-8?B?bmF0dnNp?= Microsoft Excel Misc 3 23rd May 2005 06:41 PM
How do I calculate charges based on elasped time(H:MM) & rate($)? =?Utf-8?B?Z2xhc3MtYXJ0aXN0LXdlYi1kZXZlbG9wZXI=?= Microsoft Excel Misc 1 12th Mar 2005 02:09 AM
Time Variable (elasped time) calculations Sonny Spears Microsoft Excel Worksheet Functions 1 18th Jul 2003 08:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:35 PM.