Calculating Time

M

Maria Lindquist

How do you calculate time length in queries in Access?
For instance, I need to figure out how much time is
between the following times:

StartTime = 10:00 AM
EndTime = 2:15 PM

What would be the expression for that and how do you do
it?
 
M

May

SELECT Table1.name, Table1.date, Table1.date1,
DateDiff("h",[date],[date1]) AS [=diffdate]
FROM Table1;

It will work.
h-hours
m-mins
s-seconds
y-year
m-month
d-day

May
MCP in Access and SQL Server
 
M

Maria Lindquist

Is there a way to do this using an expression in a ms
access query?

-----Original Message-----
SELECT Table1.name, Table1.date, Table1.date1,
DateDiff("h",[date],[date1]) AS [=diffdate]
FROM Table1;

It will work.
h-hours
m-mins
s-seconds
y-year
m-month
d-day

May
MCP in Access and SQL Server


-----Original Message-----
How do you calculate time length in queries in Access?
For instance, I need to figure out how much time is
between the following times:

StartTime = 10:00 AM
EndTime = 2:15 PM

What would be the expression for that and how do you do
it?
.
.
 
J

John Vinson

How do you calculate time length in queries in Access?
For instance, I need to figure out how much time is
between the following times:

StartTime = 10:00 AM
EndTime = 2:15 PM

What would be the expression for that and how do you do
it?

The DateDiff() function does this. If you want the duration in miNutes
use

TimeElapsed: DateDiff("n", [StartTime], [EndTime])

Using "m" will get the time elapsed... in Months! so be sure to use
"n".
 
M

Maria Lindquist

What if say I wanted it to bring in the hours in decimal

for example for StartTime 10:00 AM - EndTime 11:45, it
would equal 1.75
-----Original Message-----
How do you calculate time length in queries in Access?
For instance, I need to figure out how much time is
between the following times:

StartTime = 10:00 AM
EndTime = 2:15 PM

What would be the expression for that and how do you do
it?

The DateDiff() function does this. If you want the duration in miNutes
use

TimeElapsed: DateDiff("n", [StartTime], [EndTime])

Using "m" will get the time elapsed... in Months! so be sure to use
"n".


.
 
M

May

Create a new field in a query and key in the following
diffdate: DateDiff("h",[date],[date1])

May
MCP in Access and SQL Server
-----Original Message-----
SELECT Table1.name, Table1.date, Table1.date1,
DateDiff("h",[date],[date1]) AS [=diffdate]
FROM Table1;

It will work.
h-hours
m-mins
s-seconds
y-year
m-month
d-day

May
MCP in Access and SQL Server


-----Original Message-----
How do you calculate time length in queries in Access?
For instance, I need to figure out how much time is
between the following times:

StartTime = 10:00 AM
EndTime = 2:15 PM

What would be the expression for that and how do you do
it?
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top