views:

46

answers:

1

There is a time stamp column/field in a table, and the format is like

2009-12-05 10:35:28,

Now I want to get the time in terms of minutes(How many minutes have elapsed) elapsed from then on, how to do it?

+2  A: 

TIMEDIFF() can be used to get a difference between date/time values, which is expressed in a "HH:MM:SS.SSSSSS" format.

TIME_TO_SEC() can convert this into a number of seconds.

SELECT TIME_TO_SEC(TIMEDIFF(NOW(), my_date_and_timestamp)) / 60;
Amber