Are there any script functions for working with dates and times?
I’d like to work with the date and time as an integer so I can get the difference in hours between two date variables. I can do Date1 - Date2 but the result is another date. I’m just wanting the hours.
Something like JavaScripts Date.getTime() would be very helpful.
If you need to do any work with the IFS calendars, consider looking at the work_time_counter_API. This API provides methods for calculating numbers of working days between two dates or finding the next valid working day.
good info- thx.
I noticed that TIMESTAMPDIFF() doesn’t work in IFS SQL Query Tool. What would be the equivalent to us in quick reports?
TIMESTAMPDIFF is a function in DB2 and MySQL, but it is not valid in Oracle Database.
If you want the difference in hours, take the difference in days and multiply by 24.
(lag_dt - dt) * 24 AS tsd
If you want to ignore minutes and seconds, you can truncate each to their hour before taking this difference.
(TRUNC(lag_dt, 'HH24') - TRUNC(dt, 'HH24')) * 24 AS tsd
Thx, Durette! Good to know.
Thanks for the replies. I stopped getting notifications of replies so I apologize for the delay.
On FSM Mobile the database is SQLite so the function I used was strftime() to get the difference in seconds between two dates. rsbisho2’s reply got me on the right track even though the Oracle functions weren’t available to me.
Thanks again!
Oracle Date and Time
Determine the interval breakdown between two dates for a DATE datatype