Coverting time to number and subtracting the two [message #432496] |
Tue, 24 November 2009 09:30  |
namb
Messages: 35 Registered: September 2009
|
Member |
|
|
Dear Friends,
I have two columns in the table in_time and out_time both are varchar type in which time is stored in 24 hour format. I want to subtract the in_time from out_time and for that i am using the following code
to_number(Trim(replace(out_time,':','.')))-
to_number(Trim(replace(in_time,':','.')))
Now the code works fine normally but the problem is that it takes into consideration 100 not the 60 factor while subtracting as in an hour we have 60 minutes.
For an eg if the in time is 09:20 and the out_time is 19:15 the difference comes out to be 9:95 where as it should be 09:55 please help here. If the fields would have been in date type datatype the conversion is easy but how to go about in char type datatype how to find the time difference here.
Thanks in advance
|
|
|
|
|