Saturday, 7 June 2014

how to calculate the difference between two datetimes in seconds with mysql

This is the simplest format of finding datetime difference in Minutes

select  TIMESTAMPDIFF(
SECOND , '2013-10-19 10:42:53',  '2013-10-19 10:43:53' ) AS minutes from table name


 If u  want to give the column names to find datetime diference.....

select  TIMESTAMPDIFF(
SECOND , colname1,  colname2 ) AS minutes from table name

how to calculate the difference between two datetimes in hours with mysql

This is the simplest format of finding datetime difference in Minutes

select  TIMESTAMPDIFF(
HOUR, '2013-10-19 10:42:53',  '2013-10-19 10:43:53' ) AS minutes from table name


 If u  want to give the column names to find datetime diference.....

select  TIMESTAMPDIFF(
HOUR, colname1,  colname2 ) AS minutes from table name

how to calculate the difference between two datetimes in minutes with mysql

This is the simplest format of finding datetime difference in Minutes

select  TIMESTAMPDIFF(
MINUTE , '2013-10-19 10:42:53',  '2013-10-19 10:43:53' ) AS minutes from table name


 If u  want to give the column names to find datetime diference.....

select  TIMESTAMPDIFF(
MINUTE , colname1,  colname2 ) AS minutes from table name