Get run time from date time stamps

  • Thread starter Thread starter GWB
  • Start date Start date
G

GWB

I need to get run time in minutes from between a series of date/time stamps.
I have no clue of how to do this.. any help would be greatly appreciated
 
I need to get run time in minutes from between a series of date/time stamps.
I have no clue of how to do this.. any help would be greatly appreciated

Probably by using the DateDiff() function:

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

will calculate the difference in time in miNutes ("m" is Months).

It's not clear from your post what kind of "series" this is; feel free to post
some description of your table structure if you need more help.
 
Try this --
SELECT [YourTable].[DateField], DateDiff("n", [YourTable].[DateField],
(SELECT TOP 1 [XX].[DateField] FROM YourTable AS [XX] WHERE
[YourTable].[DateField] > [XX].[DateField] ORDER BY [XX].[DateField] DESC))
AS Run_Time
FROM YourTable
ORDER BY [YourTable].[DateField];
 
John - this works perfect except the minute are all negative ie... -123

KARL DEWEY said:
Try this --
SELECT [YourTable].[DateField], DateDiff("n", [YourTable].[DateField],
(SELECT TOP 1 [XX].[DateField] FROM YourTable AS [XX] WHERE
[YourTable].[DateField] > [XX].[DateField] ORDER BY [XX].[DateField] DESC))
AS Run_Time
FROM YourTable
ORDER BY [YourTable].[DateField];


--
Build a little, test a little.


GWB said:
I need to get run time in minutes from between a series of date/time stamps.
I have no clue of how to do this.. any help would be greatly appreciated
 
Well, not sure if you were replying to me or to Karl but... just reverse the
order of [yourtable].[datefield] and the subquery, or put a minus sign before
the datediff.
John - this works perfect except the minute are all negative ie... -123

KARL DEWEY said:
Try this --
SELECT [YourTable].[DateField], DateDiff("n", [YourTable].[DateField],
(SELECT TOP 1 [XX].[DateField] FROM YourTable AS [XX] WHERE
[YourTable].[DateField] > [XX].[DateField] ORDER BY [XX].[DateField] DESC))
AS Run_Time
FROM YourTable
ORDER BY [YourTable].[DateField];


--
Build a little, test a little.


GWB said:
I need to get run time in minutes from between a series of date/time stamps.
I have no clue of how to do this.. any help would be greatly appreciated
 
Back
Top