Simpanoz
Simpanoz

Reputation: 2859

How can I get difference of two dates through MYSQL select query

How can I get difference of two dates (up to seconds precision) through MYSQL select query.

Can some one guide me in this regards.

Upvotes: 1

Views: 633

Answers (2)

powtac
powtac

Reputation: 41040

Returns the difference in seconds between two dates.

SELECT TIME_TO_SEC(TIMEDIFF('2007-01-09 10:24:46','2007-01-09 10:23:46'));

Upvotes: 3

Gaurav
Gaurav

Reputation: 28755

You can use DATEDIFF() or TIMEDIFF()

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

Upvotes: 1

Related Questions