• <tfoot id='8rtzR'></tfoot>
  • <small id='8rtzR'></small><noframes id='8rtzR'>

    1. <i id='8rtzR'><tr id='8rtzR'><dt id='8rtzR'><q id='8rtzR'><span id='8rtzR'><b id='8rtzR'><form id='8rtzR'><ins id='8rtzR'></ins><ul id='8rtzR'></ul><sub id='8rtzR'></sub></form><legend id='8rtzR'></legend><bdo id='8rtzR'><pre id='8rtzR'><center id='8rtzR'></center></pre></bdo></b><th id='8rtzR'></th></span></q></dt></tr></i><div id='8rtzR'><tfoot id='8rtzR'></tfoot><dl id='8rtzR'><fieldset id='8rtzR'></fieldset></dl></div>

        • <bdo id='8rtzR'></bdo><ul id='8rtzR'></ul>
        <legend id='8rtzR'><style id='8rtzR'><dir id='8rtzR'><q id='8rtzR'></q></dir></style></legend>

        MySQL 中两个时间字段的分钟数差异

        时间:2023-06-01

          <i id='x1JWl'><tr id='x1JWl'><dt id='x1JWl'><q id='x1JWl'><span id='x1JWl'><b id='x1JWl'><form id='x1JWl'><ins id='x1JWl'></ins><ul id='x1JWl'></ul><sub id='x1JWl'></sub></form><legend id='x1JWl'></legend><bdo id='x1JWl'><pre id='x1JWl'><center id='x1JWl'></center></pre></bdo></b><th id='x1JWl'></th></span></q></dt></tr></i><div id='x1JWl'><tfoot id='x1JWl'></tfoot><dl id='x1JWl'><fieldset id='x1JWl'></fieldset></dl></div>
              <tbody id='x1JWl'></tbody>

            <legend id='x1JWl'><style id='x1JWl'><dir id='x1JWl'><q id='x1JWl'></q></dir></style></legend>

                <tfoot id='x1JWl'></tfoot>
                • <bdo id='x1JWl'></bdo><ul id='x1JWl'></ul>

                  <small id='x1JWl'></small><noframes id='x1JWl'>

                • 本文介绍了MySQL 中两个时间字段的分钟数差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我使用字段时间"设置了我的 MySQL 数据库

                  I set up my MySQL database with the field 'time'

                  它不是传统意义上的 HH:MM,它是一个事件发生的时间,所以一个值为 5:45 的事件在比赛还剩 5 分 45 秒时发生.12:25 发生,还剩 12 分 25 秒等

                  It is not HH:MM in the traditional sense, it is the time an event occurred, so an event with the value of 5:45 occurred with 5 minutes 45 seconds left in a game. 12:25 occurred with 12 minutes and 25 seconds left, etc.

                  我希望能够找出经过的总时间,所以如果我有一个事件发生在 12:25,而下一个事件发生在 5:45,我希望能够得到差异,这将等于 6:40.然后,我想将其表示为小数,在本例中为 6.67.

                  I would like to be able to find out the total time elapsed, so if I have an event that occurred at 12:25 and the next event occurred at 5:45 I want to be able to get the difference, which would be equal to 6:40. Then, I would like to express this as a decimal, in this case 6.67.

                  这可能吗?

                  提前致谢.

                  推荐答案

                  就用

                  TIMEDIFF(fromtime, totime):
                  
                  SELECT TIMEDIFF("12:25", "5:45");
                  

                  如果您需要小数,请使用 TIME_TO_SEC()/3600(它假设您传递了秒数,但是您存储时间的格式是模糊的,SQL 可能会将它们解释为 HH:MM - 你可以用 CONCAT("00:",MinuteSecondField) 解决这个问题吗?) - 然后你可以使用 TIME_TO_SEC()/60,这是更正确的)

                  If you need a decimal, use TIME_TO_SEC()/3600 (it assumes you passed it seconds, but the format you're storing the times in is vague and SQL probably will interpret them as HH:MM - you can fix this with CONCAT("00:",MinuteSecondField) maybe?) - then you can use TIME_TO_SEC()/60, which is more correct)

                  这篇关于MySQL 中两个时间字段的分钟数差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MySQL 连接运算符 下一篇:如果未找到单行,则返回默认值

                  相关文章

                  1. <tfoot id='lQ2bR'></tfoot>

                    <small id='lQ2bR'></small><noframes id='lQ2bR'>

                    <legend id='lQ2bR'><style id='lQ2bR'><dir id='lQ2bR'><q id='lQ2bR'></q></dir></style></legend>
                      • <bdo id='lQ2bR'></bdo><ul id='lQ2bR'></ul>
                      <i id='lQ2bR'><tr id='lQ2bR'><dt id='lQ2bR'><q id='lQ2bR'><span id='lQ2bR'><b id='lQ2bR'><form id='lQ2bR'><ins id='lQ2bR'></ins><ul id='lQ2bR'></ul><sub id='lQ2bR'></sub></form><legend id='lQ2bR'></legend><bdo id='lQ2bR'><pre id='lQ2bR'><center id='lQ2bR'></center></pre></bdo></b><th id='lQ2bR'></th></span></q></dt></tr></i><div id='lQ2bR'><tfoot id='lQ2bR'></tfoot><dl id='lQ2bR'><fieldset id='lQ2bR'></fieldset></dl></div>