Hi,
You can use Timediff :
mysql> SELECT TIMEDIFF('2005-07-27 18:00', '2005-07-27 19:30');
+--------------------------------------------------+
| TIMEDIFF('2005-07-27 18:00', '2005-07-27 19:30') |
+--------------------------------------------------+
| -01:30:00 |
+--------------------------------------------------+
1 row in set (0.00 sec)
mysql>
mysql>
mysql>
mysql>
mysql> SELECT TIMEDIFF('2005-07-27 19:30', '2005-07-27 18:00');
+--------------------------------------------------+
| TIMEDIFF('2005-07-27 19:30', '2005-07-27 18:00') |
+--------------------------------------------------+
| 01:30:00 |
+--------------------------------------------------+
1 row in set (0.00 sec)
more in http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
Mathias
> Selon Gyurasits Zoltán <[EMAIL PROTECTED]>:
>
> > 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!
> >
>
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]