Nicholas Williams
10/25/2023, 1:47 PMShai Coleman
10/25/2023, 2:30 PMSELECT (to_date(sys_extract_utc(systimestamp)) - to_date('1970-01-01', 'YYYY-MM-DD')) * 86400 + to_char(sys_extract_utc(systimestamp), 'SSSSS') FROM DUAL
Nicholas Williams
10/25/2023, 2:35 PMShai Coleman
10/25/2023, 2:38 PMsystimestamp
, you need to change it to your field of choice, and same with the other field, and then subtract the two, and you'll get the difference in secondsNicholas Williams
10/25/2023, 2:43 PMShai Coleman
10/25/2023, 2:52 PMShai Coleman
10/25/2023, 2:53 PMNicholas Williams
10/25/2023, 2:54 PMShai Coleman
10/25/2023, 2:58 PMSELECT (to_date(sys_extract_utc(lastmodifieddate)) - to_date('1970-01-01', 'YYYY-MM-DD')) * 86400 + to_char(sys_extract_utc(lastmodifieddate), 'SSSSS') -
(to_date(sys_extract_utc(createddate)) - to_date('1970-01-01', 'YYYY-MM-DD')) * 86400 + to_char(sys_extract_utc(createddate), 'SSSSS')
FROM transaction
Nicholas Williams
10/25/2023, 3:05 PMShai Coleman
10/25/2023, 3:12 PMSELECT ((to_date(sys_extract_utc(lastmodifieddate)) - to_date('1970-01-01', 'YYYY-MM-DD')) * 86400 + to_char(sys_extract_utc(lastmodifieddate), 'SSSSS')) -
((to_date(sys_extract_utc(createddate)) - to_date('1970-01-01', 'YYYY-MM-DD')) * 86400 + to_char(sys_extract_utc(createddate), 'SSSSS'))
FROM transaction
Nicholas Williams
10/25/2023, 3:13 PMDavid B
10/25/2023, 10:49 PMTO_NUMBER(REGEXP_SUBSTR((lastmodifieddate - createddate)*24,'^[+-]\d+'))
• timestamp-timestamp gives a 'DAY to SECOND' interval type
• multiplying it by 24 gives it in hours
• then wrapping it in a TO_NUMBER(REGEXP_SUBSTR(...))
gives us the (whole) hours.
see screenshot (timestamps are displaying as 'day hour-min-sec')Nicholas Williams
10/26/2023, 2:14 PMNicholas Williams
10/26/2023, 2:19 PMDavid B
10/26/2023, 7:36 PMFred Pope
11/02/2023, 2:13 AMDavid B
11/02/2023, 2:13 AMShai Coleman
11/08/2023, 7:13 PMDATE
keyword.
SELECT ((to_date(sys_extract_utc(lastmodifieddate)) - DATE '1970-01-01') * 86400 + to_char(sys_extract_utc(lastmodifieddate), 'SSSSS')) -
((to_date(sys_extract_utc(createddate)) - DATE '1970-01-01') * 86400 + to_char(sys_extract_utc(createddate), 'SSSSS'))
FROM transaction