Best way to convert DateTime to “n Hours Ago” in SQL

前端 未结 7 1818
醉酒成梦
醉酒成梦 2021-01-18 03:52

I wrote a SQL function to convert a datetime value in SQL to a friendlier \"n Hours Ago\" or \"n Days Ago\" etc type of message. And I was wondering if there was a better wa

相关标签:
7条回答
  • 2021-01-18 04:26

    Your code looks functional. As for a better way, that is going to get subjective. You might want to check out this page as it deals with time spans in SQL.

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