Reputation: 25294
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?
Upvotes: 3
Views: 6226
Reputation: 1
SELECT TIMESTAMPDIFF(MINUTE,your_timestamp_column_name,NOW()) AS minutes_elapsed FROM your_table_name WHERE your_criteria
Upvotes: 0
Reputation: 526593
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;
Upvotes: 11