Calculating the difference between two dates and times

  • Thread starter Thread starter KARL DEWEY
  • Start date Start date
K

KARL DEWEY

Use DateDiff function.
d - days
h - hours
n - minutes
s - seconds
w - weeks
m - months
q - quarters
yyyy - years

DateDiff("d", [Date1], [Date2])
Bear in mind that if your dates are today and yesterday there is only one
day difference, not two. So if you want inculsive you must add one.
 
Is it possible to return an an answer that includes both years and months?
An example of what I am seeking is:
Start date = 1/1/2000
Today's date = 3/23/2009

I am looking for a formula that states 9 years 3 months. Is this possible?
 
Try dividing your units (minutes) by their quanity (60) in the higher time
element (hour) and working the math.

Dow_Jones said:
Is it possible to return an an answer that includes both years and months?
An example of what I am seeking is:
Start date = 1/1/2000
Today's date = 3/23/2009

I am looking for a formula that states 9 years 3 months. Is this possible?
--
The common gavel


KARL DEWEY said:
Use DateDiff function.
d - days
h - hours
n - minutes
s - seconds
w - weeks
m - months
q - quarters
yyyy - years

DateDiff("d", [Date1], [Date2])
Bear in mind that if your dates are today and yesterday there is only one
day difference, not two. So if you want inculsive you must add one.
 
Hi, I'm new to access and I am creating a database where this function would
be very useful. However instead of a difference I need to sum 2 different
time fields in hours:minutes. and display the tolal hours worked. Thank you
 
Actually I tried to get this to work with no success. I will need some help
on this. The database I have displays the attendance of volunteers on a
table that has columns [Day, Time in, Time Out] All volunteers have a up to
3 days of work Friday, Saturday or Sunday for Day, and the time is in medium
time Format. I want to have either a column in the same table that displays
the total hours worked per day, and also if there's a way to have a Total
hours for all days each volunteer worked. The way I have it set up is such
that the attendance and volunteers tables are related through a query (like
was done on the Students template for Access 2007 between students and
attendance). This way each student can have several rows in the attendance
field, but then a sub form displays the attendance for each student only.



Please See the related threads below for more info on this database :

https://www.microsoft.com/office/co...ffice-access&lang=en&cr=US&sloc=en-us&m=1&p=1

&

https://www.microsoft.com/office/co...ffice-access&lang=en&cr=US&sloc=en-us&m=1&p=1
 
Back
Top