473,320 Members | 2,107 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.

How To Calculate The Minutes Between Two Different Times In A Query

Hi, I hope someone can help me

I have a Callback database that logs the time that a customer has called our department and have been unable to contact who they where after. When this happens a Callback would have been logged onto the database system. The information is logged and stored in my main table. I then have another table that records all the attempts that have been made by an agent to contact the customer back. These two tables are linked together using a MessageID auto number. This works fine, my issue is that i would like to produce a query that can calculate the turn around time from the customers first call to the time an agent has tried to contact the customer back.

For example:
MessageID SaveDate SaveTime Agent
173570 14/09/2010 14.13 Joe

MessageID AttemptID Attempt AttemptDate Attempttime Agent
173570 80681 1 14/09/2010 15.18 Sam

For some reason when i post my example it removes the spaces between the fields. In this example the turn around time would be 65 minutes. How can I calculate the time difference in minutes from 14.13 to 15.18 into a column at the end of my query.

Any help would be greatly appreciated
Sep 15 '10 #1

✓ answered by liimra

Just use
Expand|Select|Wrap|Line Numbers
  1. DateDiff("n", [SaveTime], [Attempttime])
Since you have the two tables linked through MessageID, you don't have to do anything else. Create the Query with "SaveTime" & "Attempttime" and any additional fields and add one column to your query in design view and insert this in the "Field"

Expand|Select|Wrap|Line Numbers
  1. Duration: DateDiff("n", [SaveTime], [Attempttime])
Regards,
Ali

3 2162
liimra
119 100+
Just use
Expand|Select|Wrap|Line Numbers
  1. DateDiff("n", [SaveTime], [Attempttime])
Since you have the two tables linked through MessageID, you don't have to do anything else. Create the Query with "SaveTime" & "Attempttime" and any additional fields and add one column to your query in design view and insert this in the "Field"

Expand|Select|Wrap|Line Numbers
  1. Duration: DateDiff("n", [SaveTime], [Attempttime])
Regards,
Ali
Sep 15 '10 #2
TheSmileyCoder
2,322 Expert Mod 2GB
For some reason when i post my example it removes the spaces between the fields. In this example the turn around time would be 65 minutes. How can I calculate the time difference in minutes from 14.13 to 15.18 into a column at the end of my query.
If you enclose the text you want to line up in code tags, the whitespace will be kept:
[code]my tables go in here[/code]
For example:
Expand|Select|Wrap|Line Numbers
  1. MessageID AttemptID Attempt AttemptDate Attempttime Agent 
  2. 173570    80681     1       14/09/2010  15.18       Sam
Sep 16 '10 #3
I managed to figure the code out before i got to see your reply, but thanks for your response, its greatly appreciated
Sep 16 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: anagai | last post by:
I have a datetime field that records date and time. This field records when rec is created. I also have a timestamp field that records whenever the record is updated. I noticed that when i first...
0
by: bazubwabo | last post by:
hi everybody, Could u please help me to find out an asp code for to determine 2 different times . I would like to create 2# times(timein,timeout ) where the 1st one is a time which a user uses the...
1
by: anubha12 | last post by:
hi ALL, i want a different types query for practice the sql server.i am just start learning a sql server..so suggest to me a some websites where the query is available.. thnax in advanced
4
by: vishwadeepsharma | last post by:
Hi Freinds, We are facing a very strange problem. Our system consists of UNIX batches which call the PLSQL procedures to execute the validations on the database. We have a list of plsql procedure...
1
by: dhoward | last post by:
I'm having a certain situation. On my application, if a user has the choice to apply for the same permit more than once but on different times. Now the first application would be 100.00 but any...
1
by: Yammi | last post by:
Ok, I know that there is a very smart programmer out there that can resovle my issue. I am trying to calculate time worked by 15 minute intervals. Example: ================= Emp 1 started...
1
by: Bakarre | last post by:
To display a field from databse and calculate time different -------------------------------------------------------------------------------- Good day, i have problem to display a field from...
7
by: orajat | last post by:
hi, how do i calculate difference in time in seconds (00:09:05 - 00:09:00 = 300) where start time being a field and the difference in time is calculated in AHT field, ie last record minus previous...
5
by: jedieagle | last post by:
I am working on a report where I use the same query with different data sources. both databases are build the same way and I can show the data from both datasets. At the moment it looks like this: ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.