Difference in minutes between two dates
hi, hope in your help.
this query working:
Code:
mysql> SELECT
DATEDIFF(
STR_TO_DATE(
'15/01/2012 08:02:00',
'%d/%m/%Y %h:%i:%s'
),
STR_TO_DATE(
'14/01/2012 08:00:00',
'%d/%m/%Y %h:%i:%s'
)
) AS output;
+--------+
| output |
+--------+
| 1 |
+--------+
I need difference in minutes between two dates and tried this version:
Code:
mysql>
SELECT
DATE_ADD(
STR_TO_DATE(
'15/01/2012 08:02:00',
'%d/%m/%Y %h:%i:%s'
) INTERVAL STR_TO_DATE(
'14/01/2012 08:00:00',
'%d/%m/%Y %h:%i:%s') MINUTE
) AS output;
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTERVAL STR_TO_DATE(
'14/01/2012 08:00:00',
'%d/%m/%Y %h:%i:%s' MINUTE' at line 6
Can you help me?
thank you