Home » Developer & Programmer » Forms » Hours and Minutes Total (Oracle 10g, Windows)
Hours and Minutes Total [message #554867] Fri, 18 May 2012 02:36 Go to next message
snsiddiqui
Messages: 172
Registered: December 2008
Senior Member
In my attendance system I am calculating overtime on daily basis in hours and minutes fields respectively now I have to sum up these values therefore I applied simple sum function to hours and minutes fields.

Lets suppose hours total is 75 and minutes total is 223.8, after division minutes with 60 result is 3.73 and final result look like this 78.73, which is ceating confusion. Correct result is 79.13.

If anybody has any solution, please update.
Re: Hours and Minutes Total [message #554870 is a reply to message #554867] Fri, 18 May 2012 02:47 Go to previous messageGo to next message
Michel Cadot
Messages: 68666
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
Correct result is 79.13.


Why?

Regards
Michel
Re: Hours and Minutes Total [message #554879 is a reply to message #554870] Fri, 18 May 2012 04:44 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that you took it wrong. 223.8 / 60 = 3.73 HOURS.
75 hours + 3.73 hours = 78.73 hours

You then thought that 0.73 represents 73 minutes which is 1 hour and 13 minutes so - finally - you added 75 hours + 3 hours + 1 hour + 13 minutes = 79.13

0.73 hours, of course, is NOT 73 minutes but 0.73 hours * 60 minutes/hour = 43.8 minutes.

Don't worry and sleep well, 78.73 is OK.

(By the way, who calculates overtime in SECONDS? Because, 223.8 minutes really is 223 minutes and 48 seconds).
Re: Hours and Minutes Total [message #554884 is a reply to message #554879] Fri, 18 May 2012 05:58 Go to previous messageGo to next message
snsiddiqui
Messages: 172
Registered: December 2008
Senior Member
Thanks

I agree with you but I want to convert my value into 43.8 rathar then 0.73, then how?
Re: Hours and Minutes Total [message #554886 is a reply to message #554884] Fri, 18 May 2012 06:02 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How? Didn't I already do that?
Re: Hours and Minutes Total [message #557466 is a reply to message #554867] Tue, 12 June 2012 23:48 Go to previous message
abrarji
Messages: 8
Registered: June 2012
Location: Pakistan
Junior Member

Dear First you need to separate Hours and decimale figures... Using Trunc Function

nvl(TRUNC(ATTENDANCE_HOURS),0)+ROUND(((ATTENDANCE_HOURS)-TRUNC(ATTENDANCE_HOURS))*60/100,2) TOTAL_DUTY_HOURS

Then you can get total hours and minutes

Abrar
Previous Topic: Update impossible
Next Topic: Get User IP Address
Goto Forum:
  


Current Time: Sat Jul 06 09:58:48 CDT 2024