Re: Time calculation in sqlplus

From: Zbigniew Sliwa <zibi_at_at_yahoo.com>
Date: Tue, 05 Dec 2000 08:20:04 +0100
Message-ID: <3A2C9724.4D383EC2_at_yahoo.com>


Hi,

If you want to receive the time beetween 2 dates you have to substract theses 2 dates. You will receive the number of days between these 2 dates (as a number, often with a fraction). If you want to convert this number to days, hours, minutes and seconds then you have to do:

days := TRUNC(dtEnd - dtFrom);
hours := MOD(TRUNC((dtEnd - dtFrom)*24), 24); minutes := MOD(TRUNC((dtEnd - dtFrom)*24*60),60); seconds := MOD(TRUNC((dtEnd - dtFrom)*24*60*60),60);

-- 
Regards,

Zbigniew Sliwa
Oracle Programmer
Poland
email: zibi_at_at_yahoo.com

cleans_at_hotmail.com wrote:

>
> Hi
>
> I am working on employees attendance system. The main table logs
> in the start_time and end_time everyday for each employee. Now i want
> to calculate the difference between these two fields to achieves no of
> Hours/Minutes every employee has put in each day.
>
> Could somebody show the way to do this.
>
> Thanks
> Clement
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Received on Tue Dec 05 2000 - 08:20:04 CET

Original text of this message