472,982 Members | 1,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

Calculating Elapsed Minutes

Greetings,

A friend tells me that he has not been able to work out an expression
that calculates elapsed minutes from TimeA to TimeB.

For example:

TIMEA TIMEB ELAPASED
----- ----- --------
11:30AM 12:35PM 65

Suggestions?

Nov 12 '05 #1
4 5544
On Mon, 02 Feb 2004 16:19:23 -0800, bonehead <se**********@here.org>
wrote:
Greetings,

A friend tells me that he has not been able to work out an expression
that calculates elapsed minutes from TimeA to TimeB.

For example:

TIMEA TIMEB ELAPASED
----- ----- --------
11:30AM 12:35PM 65

Suggestions?

Use DateDiff function:

?DateDiff("n",#11:30AM#,#12:35PM#)
65

- Jim
Nov 12 '05 #2
For an explanation of the issue involved, see:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"bonehead" <se**********@here.org> wrote in message
news:40**************@here.org...
Greetings,

A friend tells me that he has not been able to work out an expression
that calculates elapsed minutes from TimeA to TimeB.

For example:

TIMEA TIMEB ELAPASED
----- ----- --------
11:30AM 12:35PM 65

Suggestions?

Nov 12 '05 #3
"Jim Allensworth" <ji****@Notdatacentricsolutions.com> wrote in message news:<40****************@news.west.earthlink.net>. ..
On Mon, 02 Feb 2004 16:19:23 -0800, bonehead <se**********@here.org>
wrote:
Greetings,

A friend tells me that he has not been able to work out an expression
that calculates elapsed minutes from TimeA to TimeB.

For example:

TIMEA TIMEB ELAPASED
----- ----- --------
11:30AM 12:35PM 65

Suggestions?

Use DateDiff function:

?DateDiff("n",#11:30AM#,#12:35PM#)
65

- Jim


I have time data as four-digit numbers; would the regular time
functions work if I use string operations to glue # signs to the front
and back of them?

As it is, I use this:

Function TimeDiff(InTime, OutTime) As Integer
Dim InMSM As Integer
Dim OutMSM As Integer

'Handle nulls: this shouldn't arise
If IsNull(InTime) Then InTime = 0
If IsNull(OutTime) Then OutTime = 0

InMSM = 60 * Int(InTime / 100) + InTime Mod 100
OutMSM = 60 * Int(OutTime / 100) + OutTime Mod 100
TimeDiff = OutMSM - InMSM
End Function

This converts four-digit times into 'minutes since midnight' times.
Great for most purposes but it breaks if something overlaps midnight.
I suppose I could add clauses to the effect that 'if OutTime < InTime
then assume it's the next day'...
Nov 12 '05 #4
Allen Browne wrote:
For an explanation of the issue involved, see:
Calculating elapsed time
at:
http://allenbrowne.com/casu-13.html


Ahh, very good. Thanks to all who responded.

Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: NotGiven | last post by:
Below is a good elapsed time function I found. However, I'd like to return total seconds instead of broken down into days, hours, minutes & seconds. In other words, I want "125" instead of "2...
5
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any...
3
by: T-Narg | last post by:
I would like to produce the following output based on my XML file: My Album (2005) Elapsed Time (hh:mm:ss): 00:07:00 Song 1: title1 Length (hh:mm:ss): 00:02:30 Song 2: title2 Length...
1
by: pauly | last post by:
Hello All, I have been trying to create a query that extracts data from a table and calculates the elapsed time between records. The table called "Imported_table". I need to be able to calculate...
2
by: J M | last post by:
I rebooted a network device just few minutes ago and getting device-up-time value 3191. How do I convert a time elapsed in days hours minutes and seconds for above value? Example: This device...
2
by: Rene Ren | last post by:
I can using Environment.TickCount property to get the time elapsed since the system started. but this property using A 32-bit signed integer type, so it's can't count the time more than 24.9 days....
0
by: ravitunk | last post by:
hi all...i have a web service with a timer which has an Elapsed time of 1second(code should get executed for every second).....with the following code.....its running perfectly for the first time and...
4
by: Brian | last post by:
I have a 2000/2002 Access db that I use to collect and store my exercisetime using a form to enter. I wanted to see a summary of the total timefor each exercise so I have a subform that does this....
4
by: Pachalo | last post by:
Morning... Am working on a simple billing system and a looking for a code that can help calculate the difference in time between sessions..(am using VB.Net ) This is what is happening: l...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.