Re: Time calculation in sqlplus

From: Zbigniew Sliwa <>
Date: Tue, 05 Dec 2000 08:20:04 +0100
Message-ID: <>


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);


Zbigniew Sliwa
Oracle Programmer
email: 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
> Before you buy.
Received on Tue Dec 05 2000 - 08:20:04 CET

Original text of this message