Time Calculation [message #500879] |
Thu, 24 March 2011 05:03 |
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 #500886 is a reply to message #500879] |
Thu, 24 March 2011 06:25 |
|
Littlefoot
Messages: 21823 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
|
|
|