Use TRUNC to get only the time : Date Functions « PL SQL Data Types « Oracle PL/SQL Tutorial






SQL> create or replace function f_getTime_tx (i_diff_nr NUMBER)return VARCHAR2 is
  2      v_out_tx VARCHAR2(2000);
  3
  4      v_hr_nr NUMBER;
  5      v_min_nr NUMBER;
  6      v_sec_nr NUMBER;
  7
  8  begin
  9      v_hr_nr:=trunc(i_diff_nr/(60*60));
 10      v_min_nr:= trunc((i_diff_nr-v_hr_nr*60*60)/60);
 11      v_sec_nr:=mod(i_diff_nr,60);
 12
 13      v_out_tx:=v_hr_nr||' hours '||
 14                 v_min_nr||' min '||v_sec_nr||' sec';
 15      return v_out_tx;
 16  end f_getTime_tx;
 17  /

Function created.

SQL>
SQL> select f_getTime_tx(123) from dual;

F_GETTIME_TX(123)
--------------------
0 hours 2 min 3 sec

SQL>








21.10.Date Functions
21.10.1.Working with dates and built-in functions EXTRACT
21.10.2.TRUNC and ROUND
21.10.3.ROUND
21.10.4.ADD_MONTHS
21.10.5.LAST_DAY
21.10.6.MONTHS_BETWEEN
21.10.7.Use TRUNC to get only the time
21.10.8.Returning a point just before a specific midnight with TRUNC
21.10.9.TO_DATE('29-DEC-1988','dd-mon-yyyy')