Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Difference of date/times

Status
Not open for further replies.

jalenben1

Programmer
Jul 22, 2008
154
US
I have a ODBC query that I created and made into a spreadsheet. From there I made the spreadsheet into a table in Access. I then created a query from the table. I wanted to add the following columns in the query with a calculation:

Calculate MTTR Response Time: Date Created - Occurence Date... I have Date Created (3/26/2010 4:44 AM) - Occurence Date (3/26/2010 4:37 AM) How would I calculate in the query? How to get the time in this format (days, hours, mins, secs)



 


hi,

You can calculate DURATION by taking the difference between two dates. Date/Time/Duration values, as such, are manipulated in units of DAYS. Date/Time values can be FORMATTED as DATE & TIME. However, in order to display a DURATION in "days, hours, mins, secs" you must convert the frational part of the calculated DURATION value from DAYS to HOURS, and the fraction remainder of that calculation, from HOURS to MINUTES, and the fraction remainder of that calculation to SECONDS.

In Excel that FORMAT is [hh]:mm:ss. In SQL you must do the conversions in code.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top