Solved

TimeStamp difference

Posted on 2008-06-23
4
450 Views
Last Modified: 2011-10-03
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
Comment
Question by:tracy_p
4 Comments
 

Author Comment

by:tracy_p
Comment Utility
i addded the comment
0
 
LVL 37

Expert Comment

by:momi_sabag
Comment Utility
what do you mean by asp zone?
0
 
LVL 18

Assisted Solution

by:daveslash
daveslash earned 100 total points
Comment Utility

So, did the TIMESTAMPDIFF function not work for you?

-- DaveSlash
0
 
LVL 45

Accepted Solution

by:
Kdo earned 400 total points
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
It’s a strangely common occurrence that when you send someone their login details for a system, they can’t get in. This article will help you understand why it happens, and what you can do about it.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now