• <small id='dVEz8'></small><noframes id='dVEz8'>

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

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

        我应该在 MySQL 中使用日期时间还是时间戳数据类

        时间:2023-08-20
              • <bdo id='iXA63'></bdo><ul id='iXA63'></ul>
                • <tfoot id='iXA63'></tfoot>
                    <tbody id='iXA63'></tbody>
                • <i id='iXA63'><tr id='iXA63'><dt id='iXA63'><q id='iXA63'><span id='iXA63'><b id='iXA63'><form id='iXA63'><ins id='iXA63'></ins><ul id='iXA63'></ul><sub id='iXA63'></sub></form><legend id='iXA63'></legend><bdo id='iXA63'><pre id='iXA63'><center id='iXA63'></center></pre></bdo></b><th id='iXA63'></th></span></q></dt></tr></i><div id='iXA63'><tfoot id='iXA63'></tfoot><dl id='iXA63'><fieldset id='iXA63'></fieldset></dl></div>

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

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

                • 本文介绍了我应该在 MySQL 中使用日期时间还是时间戳数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  您是否建议使用 日期时间 或 timestamp 字段,为什么(使用 MySQL)?

                  Would you recommend using a datetime or a timestamp field, and why (using MySQL)?

                  我正在服务器端使用 PHP.

                  I'm working with PHP on the server side.

                  推荐答案

                  MySQL 中的时间戳一般用于跟踪记录的更改,并且经常在每次记录更改时更新.如果要存储特定值,则应使用日期时间字段.

                  Timestamps in MySQL are generally used to track changes to records, and are often updated every time the record is changed. If you want to store a specific value you should use a datetime field.

                  如果您的意思是要在使用 UNIX 时间戳或本机 MySQL 日期时间字段之间做出决定,请使用本机格式.您可以通过这种方式在 MySQL 中进行计算("SELECT DATE_ADD(my_datetime, INTERVAL 1 DAY)") 将值的格式更改为 UNIX 时间戳很简单 ("SELECT UNIX_TIMESTAMP(my_datetime)") 查询记录时是否要使用PHP对其进行操作.

                  If you meant that you want to decide between using a UNIX timestamp or a native MySQL datetime field, go with the native format. You can do calculations within MySQL that way ("SELECT DATE_ADD(my_datetime, INTERVAL 1 DAY)") and it is simple to change the format of the value to a UNIX timestamp ("SELECT UNIX_TIMESTAMP(my_datetime)") when you query the record if you want to operate on it with PHP.

                  这篇关于我应该在 MySQL 中使用日期时间还是时间戳数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:MySQL如何填充范围内缺少的日期? 下一篇:删除除 MySQL 中的一行之外的所有重复行?

                  相关文章

                  最新文章

                • <tfoot id='Yuci6'></tfoot>

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

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

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

                    2. <legend id='Yuci6'><style id='Yuci6'><dir id='Yuci6'><q id='Yuci6'></q></dir></style></legend>