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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Subtracting Time Fields



 
 
Thread Tools Display Modes
  #1  
Old May 30th, 2008, 02:10 AM posted to microsoft.public.access.tablesdbdesign
PeteVTX
external usenet poster
 
Posts: 32
Default Subtracting Time Fields

Can anyone help?

I have two time fields (startTime and endTime) and a LunchPeriod field which
is an integer field holding minutes. Can anyone tell me the best way to
subtract StartTime from endTime and then subtract the LunchPeriod minutes to
obtain total hours worked in the day?

Any help appreciated.

regards

Pete
  #2  
Old May 30th, 2008, 04:01 AM posted to microsoft.public.access.tablesdbdesign
Irene
external usenet poster
 
Posts: 208
Default Subtracting Time Fields

hi PeteVTX,

u make a query. then u type this

SELECT table1.[start time], Table1.[end time], DateDiff("n",[start
time],[end time]) AS [total minutes], Table1.lunch, [total minutes]-[lunch]
AS wh, [wh]\60 & Format([wh] Mod 60,"\:00") AS [total wh]
FROM Table1;

table1 is your table name. then you can get the answer. hope this can help
you.

"PeteVTX" wrote:

Can anyone help?

I have two time fields (startTime and endTime) and a LunchPeriod field which
is an integer field holding minutes. Can anyone tell me the best way to
subtract StartTime from endTime and then subtract the LunchPeriod minutes to
obtain total hours worked in the day?

Any help appreciated.

regards

Pete

  #3  
Old May 30th, 2008, 06:12 AM posted to microsoft.public.access.tablesdbdesign
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Subtracting Time Fields

On Thu, 29 May 2008 18:10:03 -0700, PeteVTX
wrote:

Can anyone help?

I have two time fields (startTime and endTime) and a LunchPeriod field which
is an integer field holding minutes. Can anyone tell me the best way to
subtract StartTime from endTime and then subtract the LunchPeriod minutes to
obtain total hours worked in the day?

Any help appreciated.

regards

Pete


DateDiff("n", [StartTime], [EndTime]) - [LunchPeriod]

--

John W. Vinson [MVP]
  #4  
Old May 30th, 2008, 04:56 PM posted to microsoft.public.access.tablesdbdesign
PeteVTX
external usenet poster
 
Posts: 32
Default Subtracting Time Fields

JOhn,

Thanks - worked fine!

Regards

Pete

"John W. Vinson" wrote:

On Thu, 29 May 2008 18:10:03 -0700, PeteVTX
wrote:

Can anyone help?

I have two time fields (startTime and endTime) and a LunchPeriod field which
is an integer field holding minutes. Can anyone tell me the best way to
subtract StartTime from endTime and then subtract the LunchPeriod minutes to
obtain total hours worked in the day?

Any help appreciated.

regards

Pete


DateDiff("n", [StartTime], [EndTime]) - [LunchPeriod]

--

John W. Vinson [MVP]

 




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 02:26 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.