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  

Time Difference 24 Hours



 
 
Thread Tools Display Modes
  #1  
Old June 29th, 2008, 06:05 AM posted to microsoft.public.access.queries
Jane Schuster
external usenet poster
 
Posts: 24
Default Time Difference 24 Hours

I need to determine the difference in hours between two events.
DateDiff("d" [CollectDate],[DueDate]) gives me the difference in days and
DateDiff("h",format(CollectDate,"hh:mm"),format(Du eDate,"hh:mm")) gives me
the difference in hours, but I need to know the total hours between the two
entries.

For example: CollectDate/Time DueDate/Time DifferenceInHours
1/1/08 12:00 AM 1/3/08 12:00 AM 48 Hours (or
whatever it is)

Does anyone know the formula for returning just the hours portion of the
difference, or, in the alternative, how to convert what I have above to just
hours. Any help would be greatly appreciated.
  #2  
Old June 29th, 2008, 06:20 AM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 744
Default Time Difference 24 Hours

Awww.... you're so close.
Get the difference in minutes, then use integer division.

DateDiff("n",StartDateTime, EndDateTime)

returns the number of minutes between the two time points. Then just
use division to get the number of hours.

DateDiff("n",StartDateTime, EndDateTime)\60 = hours only
DateDiff("n",StartDateTime, EndDateTime)/60 = hours and minutes (well,
100ths of an hour).
You could use MOD to get the remaining minutes
  #3  
Old June 29th, 2008, 08:01 AM posted to microsoft.public.access.queries
Jane Schuster
external usenet poster
 
Posts: 24
Default Time Difference 24 Hours

Awww...you're so Awesome - worked like a charm. Thank you so much!

" wrote:

Awww.... you're so close.
Get the difference in minutes, then use integer division.

DateDiff("n",StartDateTime, EndDateTime)

returns the number of minutes between the two time points. Then just
use division to get the number of hours.

DateDiff("n",StartDateTime, EndDateTime)\60 = hours only
DateDiff("n",StartDateTime, EndDateTime)/60 = hours and minutes (well,
100ths of an hour).
You could use MOD to get the remaining minutes

 




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


All times are GMT +1. The time now is 08:56 PM.


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