A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Calculating the Difference between two times/ dates



 
 
Thread Tools Display Modes
  #1  
Old March 21st, 2006, 07:50 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Calculating the Difference between two times/ dates

If I have two date fields with respective time fields, how do I need to
calculate the time difference between two times that sometimes carry over to
the next day? i.e. The time difference between [Time of Onset] which is the
first time at 12/31/2005 18:00 and between [Time of Arrival] which is at
1/01/2006 02:00.
I have previously calculated the difference between two times using:

HMTime: Format([Time of Arrival]-[Time of Onset],"Short Time")

Thanks.
  #2  
Old March 21st, 2006, 08:29 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Calculating the Difference between two times/ dates

The formula you have should work.

"Simon" wrote:

If I have two date fields with respective time fields, how do I need to
calculate the time difference between two times that sometimes carry over to
the next day? i.e. The time difference between [Time of Onset] which is the
first time at 12/31/2005 18:00 and between [Time of Arrival] which is at
1/01/2006 02:00.
I have previously calculated the difference between two times using:

HMTime: Format([Time of Arrival]-[Time of Onset],"Short Time")

Thanks.

  #3  
Old March 22nd, 2006, 02:59 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Calculating the Difference between two times/ dates

It does work, when the two times are on the same day. But as in the example
below, they are on two separate days. How would I incorporate the date into
the formula for the query?

Thanks.
Simon

"Klatuu" wrote:

The formula you have should work.

"Simon" wrote:

If I have two date fields with respective time fields, how do I need to
calculate the time difference between two times that sometimes carry over to
the next day? i.e. The time difference between [Time of Onset] which is the
first time at 12/31/2005 18:00 and between [Time of Arrival] which is at
1/01/2006 02:00.
I have previously calculated the difference between two times using:

HMTime: Format([Time of Arrival]-[Time of Onset],"Short Time")

Thanks.

  #4  
Old March 22nd, 2006, 03:16 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Calculating the Difference between two times/ dates

What results are you getting. When I use your values:
[Time of Onset] 12/31/2005 18:00
Time of Arrival] 1/01/2006 02:00
And your formula:
Format([Time of Arrival]-[Time of Onset],"Short Time")
I get 8:00 which is correct. I also varied the Onset time to 18:30 and the
results is 7:30, also correct.

I also went to these values:
onset = #12/31/2005 12:59 AM#
arrive = #01/01/2006 01:00 AM#
and got 00:01

Can you tell me what results you are getting to make you believe it is not
working?

"Simon" wrote:

It does work, when the two times are on the same day. But as in the example
below, they are on two separate days. How would I incorporate the date into
the formula for the query?

Thanks.
Simon

"Klatuu" wrote:

The formula you have should work.

"Simon" wrote:

If I have two date fields with respective time fields, how do I need to
calculate the time difference between two times that sometimes carry over to
the next day? i.e. The time difference between [Time of Onset] which is the
first time at 12/31/2005 18:00 and between [Time of Arrival] which is at
1/01/2006 02:00.
I have previously calculated the difference between two times using:

HMTime: Format([Time of Arrival]-[Time of Onset],"Short Time")

Thanks.

  #5  
Old March 22nd, 2006, 05:04 PM posted to microsoft.public.access.queries
external usenet poster
 
Posts: n/a
Default Calculating the Difference between two times/ dates

One example of skewed data is the following:
[Time of Onset] 5/2/2005 22:00
[Time of Arrival] 5/3/2005 18:13.

Since the times are form two separate days, I get a result of 3:47, when in
actuality the real result should be 20:13. The question I had is how to
incorporate the date values into the aforementioned HMTime formula.

Another example of this issue is:
[Time of Onset] 10/20/2003 8:00
[Time of Arrival] 10/21/2003 4:09
The real result should be 20:09, but I get a result of 3:51. Again it is due
to the date difference.

Thanks.



"Klatuu" wrote:

What results are you getting. When I use your values:
[Time of Onset] 12/31/2005 18:00
Time of Arrival] 1/01/2006 02:00
And your formula:
Format([Time of Arrival]-[Time of Onset],"Short Time")
I get 8:00 which is correct. I also varied the Onset time to 18:30 and the
results is 7:30, also correct.

I also went to these values:
onset = #12/31/2005 12:59 AM#
arrive = #01/01/2006 01:00 AM#
and got 00:01

Can you tell me what results you are getting to make you believe it is not
working?

"Simon" wrote:

It does work, when the two times are on the same day. But as in the example
below, they are on two separate days. How would I incorporate the date into
the formula for the query?

Thanks.
Simon

"Klatuu" wrote:

The formula you have should work.

"Simon" wrote:

If I have two date fields with respective time fields, how do I need to
calculate the time difference between two times that sometimes carry over to
the next day? i.e. The time difference between [Time of Onset] which is the
first time at 12/31/2005 18:00 and between [Time of Arrival] which is at
1/01/2006 02:00.
I have previously calculated the difference between two times using:

HMTime: Format([Time of Arrival]-[Time of Onset],"Short Time")

Thanks.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding dates and times DejaVu General Discussion 4 October 26th, 2005 03:32 PM
Difference in Times bcbjork General Discussion 6 August 27th, 2005 03:42 PM
Difference between 2 times and dates Stefan Buijs Worksheet Functions 1 May 26th, 2005 02:21 PM
Averaging Times in Excel Across Dates Alan Worksheet Functions 0 December 2nd, 2003 11:59 PM
Calculating the difference between two times Kim Worksheet Functions 1 October 9th, 2003 03:17 PM


All times are GMT +1. The time now is 01:14 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.