|
Hi,
if you really want the difference between two timestamps in Years, Months,
Days, Hours, Minutes, Seconds, Microseconds,
just calculate the difference with SQL.
The following example shows the difference between 2 Timestamps:
D DS INZ
D DiffDate 20S 6
D DiffYears 4S 0 overlay(DiffDate)
D DiffMonths 2S 0 overlay(DiffDate: *Next)
D DiffDays 2S 0 overlay(DiffDate: *Next)
D DiffHours 2S 0 overlay(DiffDate: *Next)
D DiffMinutes 2S 0 overlay(DiffDate: *Next)
D DiffSeconds 2S 0 overlay(DiffDate: *Next)
D DiffMSeconds 6S 0 overlay(DiffDate: *Next)
D Timestamp1 S Z inz(Z'2005-02-01-12.00.00.000000')
D Timestamp2 S Z inz(Z'2005-01-31-10.30.00.000000')
*------------------------------------------------------------------------
C/EXEC SQL
C+ set :DiffDate = :Timestamp1 - :Timestamp2
c/END-EXEC
C DiffDate Dsply
C Eval *InLR = *On
Birgitta
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.