Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

Date/time calculations on non-date fields in a stored procedure

The start date and time and stop date and time fields in my DB is numeric (length of date fields are 8 and that of time field is 6.). I have to calculate duration for each record and return as a result dataset (with other fields) from a stored procedure. How can I do this?
You would have to break the dates and times into the pieces, multiply them into seconds and subtract, giving you the seconds, then divide to get the pieces back together. Alternatively, I would suggest calling an RPG or other HLL program inside the stored procedure to calculate the difference or use a different method altogether.


Check out this Search400.com Featured Topic: Database issues resolved

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: Tips, tutorials and more.

Dig Deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.