[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 458
  • Last Modified:

TimeStamp difference

Hi
i get the result in that two columns having date and time.for example first column is Acutal created date and second column is time stamp.
i need in third column is difference between first and second columns so that i can get elapsed time taken to submit the application.
i am not able to find asp zone .please let me know the zone.
i am using asp ,db2.

Thank You

0
tracy_p
Asked:
tracy_p
2 Solutions
 
tracy_pAuthor Commented:
i addded the comment
0
 
momi_sabagCommented:
what do you mean by asp zone?
0
 
Dave FordSoftware Developer / Database AdministratorCommented:

So, did the TIMESTAMPDIFF function not work for you?

-- DaveSlash
0
 
Kent OlsenData Warehouse Architect / DBACommented:
Hi Tracy,

I'm with Dave on this one.

You can compute the difference in ASP, or have the value returned as the result of a SELECT statement.  From DB2, it's easy.  If you want days, try something like this:

  SELECT ts1, ts2, timestampdiff (16, char (ts2 - ts1))
  FROM sometable;

The first value (16) tells the function to return the number of days.

If one of the values is a date, you'll need to convert it to timestamp (datetime).  That's easy, though it can look a bit ugly.

If you want calendar days between two values convert them to DATE data types and use the DAYS function

  SELECT date (ts1), date (ts2), days (ts2) - days (ts1)
  FROM sometable;


Good Luck,
Kent


0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now