<tfoot id='op2Ev'></tfoot>

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

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

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

        MySQL 将 timediff 输出转换为日、时、分、秒格式

        MySQL convert timediff output to day, hour, minute, second format(MySQL 将 timediff 输出转换为日、时、分、秒格式)
      1. <i id='aa79n'><tr id='aa79n'><dt id='aa79n'><q id='aa79n'><span id='aa79n'><b id='aa79n'><form id='aa79n'><ins id='aa79n'></ins><ul id='aa79n'></ul><sub id='aa79n'></sub></form><legend id='aa79n'></legend><bdo id='aa79n'><pre id='aa79n'><center id='aa79n'></center></pre></bdo></b><th id='aa79n'></th></span></q></dt></tr></i><div id='aa79n'><tfoot id='aa79n'></tfoot><dl id='aa79n'><fieldset id='aa79n'></fieldset></dl></div>

            <tbody id='aa79n'></tbody>

            <tfoot id='aa79n'></tfoot>
              <bdo id='aa79n'></bdo><ul id='aa79n'></ul>

            • <legend id='aa79n'><style id='aa79n'><dir id='aa79n'><q id='aa79n'></q></dir></style></legend>

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

                  本文介绍了MySQL 将 timediff 输出转换为日、时、分、秒格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  这是我的查询:

                  SELECT TIMEDIFF(end_time,start_time) AS "total" FROM `metrics`;
                  

                  这给了我:

                  116:12:10
                  

                  表示 116 小时 12 分 10 秒.

                  meaning 116 hours, 12 minutes and 10 seconds.

                  相反,我想说 4 天 20 小时 12 分钟等

                  Instead, I want it to say 4 days 20 hours, 12 minutes etc

                  推荐答案

                  SELECT CONCAT(
                  FLOOR(HOUR(TIMEDIFF('2010-01-06 08:46', '2010-01-01 12:30')) / 24), ' days ',
                  MOD(HOUR(TIMEDIFF('2010-01-06 08:46', '2010-01-01 12:30')), 24), ' hours ',
                  MINUTE(TIMEDIFF('2010-01-06 08:46', '2010-01-01 12:30')), ' minutes')
                  

                  在我的示例中使用 end_time 和 start_time 作为固定日期时间值

                  Use your end_time and start_time for the fixed datetime values in my example

                  根据下面的两条评论,此解决方案仅适用于 35 天内的日期差异.如果您知道开始和结束之间的时间超过 35 天,即一个月内的差异,请不要使用它.此处使用 TIMESTAMPDIFF 的其他答案将起作用.

                  As per the two comments below, this solution only works for date differences within 35 days. If you know there are more than 35 days between start and end, i.e. differences over a month, don't use it. Other answers here using TIMESTAMPDIFF will work.

                  这篇关于MySQL 将 timediff 输出转换为日、时、分、秒格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Bogus foreign key constraint fail(虚假外键约束失败)
                  how to get last insert id after insert query in codeigniter active record(如何在codeigniter活动记录中插入查询后获取最后一个插入ID)
                  Force InnoDB to recheck foreign keys on a table/tables?(强制 InnoDB 重新检查表/表上的外键?)
                  How to auto generate migrations with Sequelize CLI from Sequelize models?(如何使用 Sequelize CLI 从 Sequelize 模型自动生成迁移?)
                  Clear MySQL query cache without restarting server(无需重启服务器即可清除 MySQL 查询缓存)
                  ALTER TABLE to add a composite primary key(ALTER TABLE 添加复合主键)

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

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