Stef Merlijn
asked on
How to calculate number of minutes between two DateTime in a query?
Hi,
In Delphi I can calculate the number of minutes between two dates by using the function:
MinutesBetweenEx(StartDate Time, EndDateTime);
Is there a way to do this within a query?
I'm using a MS Access database.
Regards,
Stef
In Delphi I can calculate the number of minutes between two dates by using the function:
MinutesBetweenEx(StartDate
Is there a way to do this within a query?
I'm using a MS Access database.
Regards,
Stef
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi, mike
looks like youre few seconds later:)
ziolko.
looks like youre few seconds later:)
ziolko.
I guess it should be :
SELECT DateDiff( "n", <STARTDATE>, <ENDDATE>) AS MinutesBetween
instead of
SELECT DateDiff( mi, <STARTDATE>, <ENDDATE>) AS MinutesBetween
Best regrads,
The Mayor
SELECT DateDiff( "n", <STARTDATE>, <ENDDATE>) AS MinutesBetween
instead of
SELECT DateDiff( mi, <STARTDATE>, <ENDDATE>) AS MinutesBetween
Best regrads,
The Mayor
And use :
For Hours : SELECT DateDiff( "h", <STARTDATE>, <ENDDATE>) AS HoursBetween
For Minutes : SELECT DateDiff( "n", <STARTDATE>, <ENDDATE>) AS MinutesBetween
For seconds : SELECT DateDiff( "s", <STARTDATE>, <ENDDATE>) AS SecondsBetween
See http://www.access-programmers.co.uk/forums/showthread.php?t=14680
For Hours : SELECT DateDiff( "h", <STARTDATE>, <ENDDATE>) AS HoursBetween
For Minutes : SELECT DateDiff( "n", <STARTDATE>, <ENDDATE>) AS MinutesBetween
For seconds : SELECT DateDiff( "s", <STARTDATE>, <ENDDATE>) AS SecondsBetween
See http://www.access-programmers.co.uk/forums/showthread.php?t=14680
Yeah looks like we posted seconds apart Ziolko :o)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you both very much for the solution.
I never knew that you can use the "as"-value within the statement.
Regards,
Stef
I never knew that you can use the "as"-value within the statement.
Regards,
Stef
Glad to be of some help.
And thanks for the points and the grade.
Best regards,
The Mayor.
And thanks for the points and the grade.
Best regards,
The Mayor.
SELECT DateDiff( mi, <STARTDATE>, <ENDDATE>) AS MinutesBetween