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
 

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

Back
Top