mysql> select *,timediff(end,start) from foo;
+---------------------+---------------------+----+---------------------+
| start               | end                 | id | timediff(end,start) |
+---------------------+---------------------+----+---------------------+
| 2005-07-14 15:00:00 | 2005-07-14 17:30:00 |  1 | 02:30:00            |
| 2005-07-14 23:00:00 | 2005-07-15 01:30:00 |  2 | 02:30:00            |
| 2005-07-14 15:00:00 | 2005-07-15 02:30:00 |  3 | 11:30:00            |
| 2005-07-14 15:00:00 | 2005-07-14 16:00:00 |  4 | 01:00:00            |
+---------------------+---------------------+----+---------------------+

On Wed, 27 Jul 2005, [iso-8859-2] Gyurasits Zolt?n wrote:

Hello All!


I would like to calculate the hour counts from 2 'datetime'.
Example:   2005-07-27 18:00 and 2005-07-27 19:30  => 1,5 hour

I try this....  but not good!

R1 : munkaido_end-munkaido_start  /simple substract/
R2 : ROUND(ROUND((end-start)/10000)+ 
(((end-start)/1000-(ROUND((end-start)/10000)*10))/6),1)  /good if is in one day/
R3 : ROUND((end-start)/10000)-76  /-76 because from 14. to 15. I don't 
understand/


start               end                  R1                R2          R3
07-14 15:00     07-14 17:30     23000           2.5         -74
07-14 23:00     07-15 01:30     783000         78.5         2
07-14 15:00     07-15 02:30     873000         87.5         11
07-14 15:00     07-14 16:00     10000           1             -75

Please help me...    (exist a function for this situation?)


Tnx!


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Partner & Sr. Manager             7 West 24th Street #100     -
- +1 (443) 921-0381                 Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, purge the message from your system and notify the sender immediately. Any other use of the email by you is prohibited.
-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to