Re: Time Problem

"[email protected]" <[email protected]> Tue, 21 Jan 2003 12:07:07 +0000 (UTC)
Newsgroups gmane.comp.db.oracle.devel
Message-ID <LYRIS-1796914-841703-2003.01.21-12.07.26--gcdod-oracle#[email protected]>
in Your example the 8.53 is the decimal notation of 8:31

You just need a simple mathemathic function that multiplies by 0.6 (/100*60)

Example :

Function TimeDiff(x_dateTime1 in date, x_dateTime2 in date) return varchar2
   temp number;
   Days number;
   Hours number;
   Minutes number;
   Seconds  number;
begin 
   temp := x_datetime1 - x_dateTime2;
   Days := trunc(temp/24);
   temp := temp temp - days;
   Hours := trunc(temp);
   temp := temp - Hours;
   Minutes := trunc(temp * 100);
   temp := 100 * temp - minutes;
   minutes := minutes * 0,6;
   seconds := trunc(temp * 100);
   temp := 100 * temp - seconds;
   seconds := seconds * 0,6;

   return to_char(Days ||' '|| Hours ||':'||Minutes||':'||Seconds||","||temp)
end;

Remark I'm writing this out of the blue. Their maybey some errors in it/ their maybey missing some errorhandling but I think you got the idea 

X

 ------------------------
 "Oracle" <[email protected]> wrote:
------------------------
	
>hi all 
>i have a two date field . i subtract a one field from an other and multiply by 24 it give hour and result like 8.53 and so on.
>but i want the result as 8:34 how i do that? 
>mean how i convert the 8.53 hour into 8(h):53(m)
>thanks
>
>_____________________________________________________________
>Get 100% private, FREE email for life!
>Visit http://inbox.com.pk
>
>_____________________________________________________________
>Select your own custom email address for FREE! Get [email protected] w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag
>
>---
>Change your mail options at http://p2p.wrox.com/manager.asp or 
>to unsubscribe send a blank email to %%email.unsub%%.
>



---
Change your mail options at http://p2p.wrox.com/manager.asp or 
to unsubscribe send a blank email to [email protected].