<tfoot id='r997p'></tfoot>
  • <legend id='r997p'><style id='r997p'><dir id='r997p'><q id='r997p'></q></dir></style></legend>

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

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

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

      1. 2 time() 值之间的差异

        Difference between 2 time() values(2 time() 值之间的差异)
          <tbody id='XORFa'></tbody>

          • <bdo id='XORFa'></bdo><ul id='XORFa'></ul>

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

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

              <tfoot id='XORFa'></tfoot>
                  <legend id='XORFa'><style id='XORFa'><dir id='XORFa'><q id='XORFa'></q></dir></style></legend>

                1. 本文介绍了2 time() 值之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有 2 个 time() 值,例如:

                  I have 2 time() values, for example:

                  1379078542
                  1379078574
                  

                  我如何计算他们的差异并将输出显示为年、月、周、日、小时、分钟、秒等.

                  How do I work out their diffidence and display the output as years, months, weeks, days, hours, minutes, seconds etc.

                  我认为上面的 2 个值相差 32 秒,所以在这种情况下,我想显示 32 秒.

                  The 2 values above have a difference of 32 seconds I think, so in this case, I would want to display 32 seconds.

                  推荐答案

                  $datetime1 = new DateTime('@1379078542');
                  $datetime2 = new DateTime('@1379078574');
                  $interval  = $datetime1->diff($datetime2);
                  $elapsed   = $interval->format('%y years, %m months, %a days, %h hours, %i minutes, %S seconds');
                  $elapsed   = str_replace(array('0 years,', ' 0 months,', ' 0 days,',  ' 0 hours,', ' 0 minutes,'), '', $elapsed);
                  $elapsed   = str_replace(array('1 years, ', ' 1 months, ', ' 1 days, ',  ' 1 hours, ', ' 1 minutes'), array('1 year, ', '1 month, ', ' 1 day, ', ' 1 hour, ', ' 1 minute'), $elapsed);
                  echo $elapsed;
                  

                  查看实际操作

                  这篇关于2 time() 值之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Converting string to MySQL timestamp format in php(在php中将字符串转换为MySQL时间戳格式)
                  datetime to timestamp(日期时间到时间戳)
                  PHP timestamp date to user timezone(PHP时间戳日期到用户时区)
                  Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)
                  Convert ISO 8601 to unixtimestamp(将 ISO 8601 转换为 unixtimestamp)
                  Finding days between 2 unix timestamps in php(在php中查找2个unix时间戳之间的天数)
                  <tfoot id='Ltu27'></tfoot>

                  1. <legend id='Ltu27'><style id='Ltu27'><dir id='Ltu27'><q id='Ltu27'></q></dir></style></legend>

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

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

                            <bdo id='Ltu27'></bdo><ul id='Ltu27'></ul>
                              <tbody id='Ltu27'></tbody>