var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Find time difference from current time stamp
I have one table where one column is used to store time in the format 'hh:mm:ss'.
I would like to find the time difference between that column of that table and current time stamp.
It would be nice if you can suggest any solution for the above requirement.
Thanks in advance,
Which of the 360,000 suggestions on Google have you tried?
90% of users' problems can be resolved by punching them - the other 10% by switching off their PCs.
Originally Posted by
below is the solution I did :
function fn_get_remaining_time(p_i_n_var in varchar2)
l_n_filled_time_mnt number :=0;
l_n_sys_time_mnt number :=0;
l_n_filled_time_mnt := (substr(p_i_n_var,1,2) * 60) + substr(p_i_n_var,4,2);
l_n_sys_time_mnt := (to_char(sysdate,'hh') * 60) + to_char(sysdate,'mm');
l_n_tm_diff := l_n_filled_time_mnt - l_n_sys_time_mnt;
if l_n_tm_diff > 60 then
l_v_remain_time := trunc(l_n_tm_diff/60,0)||':'||round(mod(l_n_tm_diff,60),2);
l_v_remain_time := 0||':'||l_n_tm_diff;
when others then
having a string containing just the hour, minute, and second is useless. what happens if the time is '12:13:14' and it is 9am, do you return a negative. What happens if the record was written yesterday, do you return over 24 hours?
Always store a timestamp as a date or timestamp column. NEVER store is as a text string.
You do not need a parachute to skydive. You only need a parachute to skydive twice.