How do I subtract using SQL in MYSQL between two date time values and retrieve the result in minutes or second?

前端 未结 5 833
长情又很酷
长情又很酷 2020-12-08 01:49

I want to subtract between two date time values using SQL in MySQL such that I get the interval in minutes or seconds. Any ideas? I want to run a SQL query that retrieves us

5条回答
  •  我在风中等你
    2020-12-08 02:43

    SELECT TIMESTAMPDIFF(MINUTE,LogOutTime,LogInTime) AS TimeLoggedIn
    FROM LogTable
    

    This example shall ruin the time if its used by using millitary time. So for calculating millitairy time I do not recommend it Because it outputs negative values.

提交回复
热议问题