× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



TIMESTAMPDIFF is supported on V5R3.
For example:

select timestampdiff(8,
cast(current_timestamp - (current_timestamp - 1 day) as char(22)))
from sysibm/sysdummy1

returns 24.

That said, be careful about using this function. It assumes 30 days month.
I could not believe IBM went along with this.

We had to work around it in our SQLUDFs project. See DateDiff UDF
description at
http://www.centerfieldtools.com/_s_q_l_01_u_d_fs.html

I'm guessing writing RPG program is probably your cheapest solution.

Elvis

Celebrating 10-Years of SQL Performance Excellence on IBM i5/OS and OS/400
http://centerfieldtechnology.com/training.asp


-----Original Message-----
Subject: Timestamp Interval in Hours

I see the TMESTAMPDIFF function in V5R4, but I'm on V5R3. Anyone know
how I can get the difference in hours between two timestamps in SQL?
I'd rather not write an RPG program, but it may take less time.

Thanks!


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.