且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

计算MySQL中两个日期时间之间的差异

更新时间:2022-12-09 17:21:20

使用

USE TIMESTAMPDIFF MySQL function. For example, you can use:

SELECT TIMESTAMPDIFF(SECOND, '2012-06-06 13:13:55', '2012-06-06 15:20:18')

在您的情况下,TIMSTAMPDIFF函数的第三个参数将是当前登录时间(NOW()).第二个参数是上次登录时间,该时间已在数据库中.

In your case, the third parameter of TIMSTAMPDIFF function would be the current login time (NOW()). Second parameter would be the last login time, which is already in the database.