473,320 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

problem with creating a duration field

Greetings,

I am trying to create a duration field in a query. I have a field with
a start time and a field with an end time. They are both in military
time, and are formatted as hours:minutes. I am trying to create a
duration field by subtracting the start time from the end time. This
is working.

However, some end times do not happen until the following day, and
this is screwing up the results. If the start time is 04:30 and the
end time is 04:40, the duration field is successfully populated with
"10" minutes. However, if the start time is 23:30 and the end time is
01:30 (the next day), instead of getting "120" in the field, I get a
"-1,320" (60 minutes x -22 hours). Is there some way to make Access
interpret the end time as always being after the start time so it will
know in these instances the end time is for the next day? Or do I have
to include the date in these time fields so Access knows to look at
the next day?

Thanks in advance to anyone who can help!

Dave
Nov 12 '05 #1
1 2224
How are you getting the duration value?

If you use the DateDiff function, you can get the number of seconds
between two Date-Time values.

DateDiff("s",#12/10/2003 11:55:50 PM#,#12/11/2003 1:03:50 AM#) = 4080

--

Danny J. Lesandrini
dl*********@hotmail.com
http://amazecreations.com
"Dave" <dh***@mmua.org> wrote in message news:ee**************************@posting.google.c om...
Greetings,

I am trying to create a duration field in a query. I have a field with
a start time and a field with an end time. They are both in military
time, and are formatted as hours:minutes. I am trying to create a
duration field by subtracting the start time from the end time. This
is working.

However, some end times do not happen until the following day, and
this is screwing up the results. If the start time is 04:30 and the
end time is 04:40, the duration field is successfully populated with
"10" minutes. However, if the start time is 23:30 and the end time is
01:30 (the next day), instead of getting "120" in the field, I get a
"-1,320" (60 minutes x -22 hours). Is there some way to make Access
interpret the end time as always being after the start time so it will
know in these instances the end time is for the next day? Or do I have
to include the date in these time fields so Access knows to look at
the next day?

Thanks in advance to anyone who can help!

Dave

Nov 12 '05 #2

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

Similar topics

2
by: windos | last post by:
Dear all, I am a new in using Crystal Report. I'm trying to add this query in CR : SELECT
2
by: Gunnar Vøyenli | last post by:
Hi Some days ago I posted a problem with a query. Thaks to Dave and John, I got a little closer to a solution. Their suggestion was a solution to my problem as I stated it, but the real problem...
5
by: angelasg | last post by:
I am working with employee schedules. Each schedule is comprised of segments (shift, lunch, break, training, etc.) that have rankings. Each record has the employee id, the date the shift starts,...
4
by: Stephen Young | last post by:
Hello Have a bit of a problem, im trying to get the total number of hours:minutes for all actions over the month in a query, have tried two methods to no luck... Duration This Month:...
8
by: Xarky | last post by:
Hi, I am creating a program, and when it is executed it stores the time. Now at each second I will display the duration of the program execution. DateTime progExecuted = DateTime.Now; I...
2
by: pradeep.thekkottil | last post by:
I'm setting up an auction website using PHP and MySQL. There in the section where logged in members can put up new auction in a form, I want to run a form validation where I used if else statements...
20
by: anthonyk | last post by:
Hi there, im hoping someone might be able to painlessly tell me what im incorrectly doing here/expecting. Im using Access 2007 I am creating a query to show ongoing tasks in a database. in...
6
by: Jim Mandala | last post by:
Using MS Access 2003 with SQL Server 2005 as a backend: I am trying to automatically check for collisions in a table of appointments with an appointment currenlty being saved from the form...
1
by: Constantine AI | last post by:
Here is the situation i am currently trying to update a sales order using PHP and javascript. When you click on the edit button it brings you a new site page with existing sales order details within....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.