|
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!
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
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.