DateDiff calculation in a query

jac_pol

New Member
Joined
May 4, 2004
Messages
7
Hi all

I'm using MS Access 2000 and I'm trying to calculate a date diff field down to the minute rather than the hour. At the moment I'm using the following code in the query, Variance: DateDiff("h",[ACTUAL_ARR_TIME],[PLANNED_ARR_TIME]). The format of the table is 19/06/2004 01:25:00

I would be eternally greatful for any help
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Thanks for the input Dennis, it didn't work, I get #ERROR showing up. I've tried all manner of combinations, "d" is days, "m" is months, "y' is years, "h" is hours and "s" is seconds. so what I worked out was to calculate the variance in seconds (EG Variance: DateDiff("s",[ACTUAL_ARR_TIME],[PLANNED_ARR_TIME]), then I created new field which divided the variance by 60 which gave me the minutes. (Minutes Late: ([Variance]/60))

Thanks again for your input.

regards
Jack Pol
 
Upvote 0
Use "n" for minutes.

From help
Code:
Setting	Description
yyyy	Year
q	Quarter
m	Month
y	Day of year
d	Day
w	Weekday
ww	Week
h	Hour
n	Minute
s	Second
 
Upvote 0

Forum statistics

Threads
1,221,771
Messages
6,161,847
Members
451,723
Latest member
Rachetsely

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top