Home » Developer & Programmer » Forms » Time Calculation (Oracle 10g, Forms 6i)
Time Calculation [message #500879] Thu, 24 March 2011 05:03 Go to next message
snsiddiqui
Messages: 172
Registered: December 2008
Senior Member
I have two different date in my payroll software,
1- Shift_date shift date *used to contain shift timings
2- Attendace_date date *used to contain employee IN timings
As you all know that shift is a setup form, where user input data once in the starting of software so the shift_date can be "01/jan/2011 16:00 pm" but attendance loads daily and attendance field data can be in this form "24/mar/2011 16:15 pm"
Now I want to calculate difference time between these two fields therefore I used this statement

SQL> Select to_char(attendance_date,'HH24:MI') to_char(shift_date,'HH24:MI') from dual;

but it is showing error: ORA-01722: invalid number

I used hours/minutes format mask in my query because you can see there is a difference of dates between these fields and it will be increase in the coming future and I need late hours and minutes.

Please give me any solution.
Re: Time Calculation [message #500881 is a reply to message #500879] Thu, 24 March 2011 05:16 Go to previous messageGo to next message
Michel Cadot
Messages: 68684
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
If you subtract the 2 dates (using minus) you get the difference in day.
If you multiply this one by 1440 you get it in minutes.
I let you do the rest to convert this number of minutes in hours and minutes.

Regards
Michel
Re: Time Calculation [message #500886 is a reply to message #500879] Thu, 24 March 2011 06:25 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Difference between two DATE datatype values is calculated by simple subtraction (nothing more!). The result is number of days which has to be recalculated if you want to display it in a more appropriate format (you know, day has 24 hours, hour = 60 minutes, minute = 60 seconds).

[EDIT]

Sorry, didn't realize that Michel already answered it as you opened two topics with the same subject. After they have being merged (and a duplicate message deleted), this is the result.

[Updated on: Thu, 24 March 2011 06:27]

Report message to a moderator

Previous Topic: INPUT BOX IN ORACLE FORMS
Next Topic: show_view taking so much time in forms10g
Goto Forum:
  


Current Time: Tue Sep 17 05:03:48 CDT 2024