clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3799039 fiddles created (41834 in the last week).

DECLARE date_out DATE := TO_DATE( '2020-11-17 15:23', 'YYYY-MM-DD HH24:MI' ); date_in DATE := TO_DATE( '2020-11-16 18:02', 'YYYY-MM-DD HH24:MI' ); function TIME_CALCULATIONFormula return NUMBER is diff INTERVAL DAY TO SECOND := (DATE_OUT - DATE_IN) DAY TO SECOND; begin RETURN EXTRACT( DAY FROM diff ) * 24 + EXTRACT( HOUR FROM diff ) + EXTRACT( MINUTE FROM diff ) / 100; end; BEGIN DBMS_OUTPUT.PUT_LINE( TIME_CALCULATIONFormula() ); END; /
1 rows affected dbms_output: 21.21
 hidden batch(es)


DECLARE date_out DATE := TO_DATE( '2020-11-17 15:23', 'YYYY-MM-DD HH24:MI' ); date_in DATE := TO_DATE( '2020-11-16 18:02', 'YYYY-MM-DD HH24:MI' ); function TIME_CALCULATIONFormula return NUMBER is diff INTERVAL DAY TO SECOND := CAST(DATE_OUT AS TIMESTAMP) - CAST(DATE_IN AS TIMESTAMP); begin RETURN EXTRACT( DAY FROM diff ) * 24 + EXTRACT( HOUR FROM diff ) + EXTRACT( MINUTE FROM diff ) / 100; end; BEGIN DBMS_OUTPUT.PUT_LINE( TIME_CALCULATIONFormula() ); END; /
1 rows affected dbms_output: 21.21
 hidden batch(es)


DECLARE date_out DATE := TO_DATE( '2020-11-17 15:23', 'YYYY-MM-DD HH24:MI' ); date_in DATE := TO_DATE( '2020-11-16 18:02', 'YYYY-MM-DD HH24:MI' ); function TIME_CALCULATIONFormula return NUMBER is begin RETURN TRUNC( ( date_out - date_in ) * 24 ) + MOD( ( date_out - date_in ) * 24 * 60, 60 ) / 100; end; BEGIN DBMS_OUTPUT.PUT_LINE( TIME_CALCULATIONFormula() ); END; /
1 rows affected dbms_output: 21.21
 hidden batch(es)


DECLARE date_out DATE := TO_DATE( '2020-11-17 15:23', 'YYYY-MM-DD HH24:MI' ); date_in DATE := TO_DATE( '2020-11-16 18:02', 'YYYY-MM-DD HH24:MI' ); function TIME_CALCULATIONFormula return VARCHAR2 is begin RETURN TO_CHAR( DATE '1900-01-01' + ( date_out - date_in ), 'HH24.MI' ); end; BEGIN DBMS_OUTPUT.PUT_LINE( TIME_CALCULATIONFormula() ); END; /
1 rows affected dbms_output: 21.21
 hidden batch(es)