How can I format a MySQL TIMEDIFF without seconds?

前端 未结 1 544
野的像风
野的像风 2021-01-13 01:02

I\'m running this SELECT statement:

TIMEDIFF(NOW(), posts.date_modified) as time_ago

And getting results in the format 0

1条回答
  •  伪装坚强ぢ
    2021-01-13 01:35

    SELECT TIME_FORMAT(TIMEDIFF(NOW(), posts.date_modified), '%H:%i') AS time_ago
    

    Consult the manual for more on TIME_FORMAT() and a table of allowed specifiers.

    0 讨论(0)
提交回复
热议问题