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

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

        SQL SERVER:获取两个日期之间的总天数

        时间:2023-10-10

          <bdo id='llEXB'></bdo><ul id='llEXB'></ul>

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

            <tfoot id='llEXB'></tfoot>
              <tbody id='llEXB'></tbody>
              1. <small id='llEXB'></small><noframes id='llEXB'>

                <i id='llEXB'><tr id='llEXB'><dt id='llEXB'><q id='llEXB'><span id='llEXB'><b id='llEXB'><form id='llEXB'><ins id='llEXB'></ins><ul id='llEXB'></ul><sub id='llEXB'></sub></form><legend id='llEXB'></legend><bdo id='llEXB'><pre id='llEXB'><center id='llEXB'></center></pre></bdo></b><th id='llEXB'></th></span></q></dt></tr></i><div id='llEXB'><tfoot id='llEXB'></tfoot><dl id='llEXB'><fieldset id='llEXB'></fieldset></dl></div>
                • 本文介绍了SQL SERVER:获取两个日期之间的总天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试获取两天之间的总天数:

                  I'm trying to get the total number of days between two days:

                  1/1/2011
                  3/1/2011
                  
                  RETURN
                  62
                  

                  是否可以在 SQL Server 中进行?

                  Is it possible to do in SQL Server?

                  推荐答案

                  PRINT DATEDIFF(DAY, '1/1/2011', '3/1/2011') will give you what you之后.

                  PRINT DATEDIFF(DAY, '1/1/2011', '3/1/2011') will give you what you're after.

                  这给出了两个日期之间跨越午夜边界的次数.如果您将两个日期都包括在计数中,您可能决定需要在其中加一个 - 如果您不想包括任何一个日期,则减去一个.

                  This gives the number of times the midnight boundary is crossed between the two dates. You may decide to need to add one to this if you're including both dates in the count - or subtract one if you don't want to include either date.

                  这篇关于SQL SERVER:获取两个日期之间的总天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:SQL Server 2008 - 获取表约束 下一篇:如何:使用 SQL Server 2008 为自动更新修改日期创建触发器

                  相关文章

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

                  • <bdo id='DAbo6'></bdo><ul id='DAbo6'></ul>
                • <small id='DAbo6'></small><noframes id='DAbo6'>

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