Jump to content

time difference between 2 time stamps


Space Cowboy

Recommended Posts

You didn't mention what version of MySQL you're using (or even if that's what you're using).

Anyway, you should be able to simply subtract one TS column from the other and multiply by 60 to give you the minutes you want.

An alternative is to use the UNIX_TIMESTAMP() function:

SELECT UNIX_TIMESTAMP(date1_column) - UNIX_TIMESTAMP(date2_column) * 60 AS diff_in_minutes FROM table_name

See this for more info:

[a href=\"http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#id3206258\" target=\"_blank\"]http://dev.mysql.com/doc/refman/4.1/en/dat....html#id3206258[/a]




Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.