<tfoot id='ZPT8L'></tfoot>

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

      <legend id='ZPT8L'><style id='ZPT8L'><dir id='ZPT8L'><q id='ZPT8L'></q></dir></style></legend>
      <i id='ZPT8L'><tr id='ZPT8L'><dt id='ZPT8L'><q id='ZPT8L'><span id='ZPT8L'><b id='ZPT8L'><form id='ZPT8L'><ins id='ZPT8L'></ins><ul id='ZPT8L'></ul><sub id='ZPT8L'></sub></form><legend id='ZPT8L'></legend><bdo id='ZPT8L'><pre id='ZPT8L'><center id='ZPT8L'></center></pre></bdo></b><th id='ZPT8L'></th></span></q></dt></tr></i><div id='ZPT8L'><tfoot id='ZPT8L'></tfoot><dl id='ZPT8L'><fieldset id='ZPT8L'></fieldset></dl></div>
      • <bdo id='ZPT8L'></bdo><ul id='ZPT8L'></ul>
    1. PHP检查时间戳是否小于30分钟

      时间:2024-04-12
      <i id='41pp3'><tr id='41pp3'><dt id='41pp3'><q id='41pp3'><span id='41pp3'><b id='41pp3'><form id='41pp3'><ins id='41pp3'></ins><ul id='41pp3'></ul><sub id='41pp3'></sub></form><legend id='41pp3'></legend><bdo id='41pp3'><pre id='41pp3'><center id='41pp3'></center></pre></bdo></b><th id='41pp3'></th></span></q></dt></tr></i><div id='41pp3'><tfoot id='41pp3'></tfoot><dl id='41pp3'><fieldset id='41pp3'></fieldset></dl></div>
          <tbody id='41pp3'></tbody>

        • <small id='41pp3'></small><noframes id='41pp3'>

        • <tfoot id='41pp3'></tfoot>

              <legend id='41pp3'><style id='41pp3'><dir id='41pp3'><q id='41pp3'></q></dir></style></legend>

                <bdo id='41pp3'></bdo><ul id='41pp3'></ul>

              • 本文介绍了PHP检查时间戳是否小于30分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在从我的数据库中获取一个项目列表,每个项目都有一个 CURRENT_TIMESTAMP,在 时间之前.所以这很好.但问题是我还想在不到 30 分钟的物品上贴上新"横幅.我如何获取生成的时间戳(例如:2012-07-18 21:11:12)并说明它是否距离当前时间不到 30 分钟,然后在该项目上回显NEW"横幅.

                I'm getting a list of items from my database, each has a CURRENT_TIMESTAMP which i have changed into 'x minutes ago' with the help of timeago. So that's working fine. But the problem is i also want a "NEW" banner on items which are less than 30 minutes old. How can i take the generated timestamp (for example: 2012-07-18 21:11:12) and say if it's less than 30 minutes from the current time, then echo the "NEW" banner on that item.

                推荐答案

                使用strtotime("-30 minutes") 然后看看你的行的时间戳是否大于那个.

                Use strtotime("-30 minutes") and then see if your row's timestamp is greater than that.

                例子:

                <?php
                    if(strtotime($mysql_timestamp) > strtotime("-30 minutes")) {
                        $this_is_new = true;
                    }
                ?>
                

                我在这里使用 strtotime() 两次来获取您的 mysql 日期的 unix 时间戳,然后再次获取 30 分钟前的时间戳.如果 30 分钟前的时间戳大于 mysql 记录的时间戳,那么它一定是在 30 分钟前创建的.

                I'm using strtotime() twice here to get unix timestamps for your mysql date, and then again to get what the timestamp was 30 minutes ago. If the timestamp from 30 mins ago is greater than the timestamp of the mysql record, then it must have been created more than 30 minutes go.

                这篇关于PHP检查时间戳是否小于30分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:将mysql时间戳转换为实际日期和时间? 下一篇:将 Unix 时间戳转换为时区?

                相关文章

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

                  1. <small id='T82Az'></small><noframes id='T82Az'>