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

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

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

      在 MySQL 中存储时区偏移的数据类型/结构

      时间:2024-04-16
      <tfoot id='o0LWS'></tfoot>
        <tbody id='o0LWS'></tbody>
        <bdo id='o0LWS'></bdo><ul id='o0LWS'></ul>

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

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

                <legend id='o0LWS'><style id='o0LWS'><dir id='o0LWS'><q id='o0LWS'></q></dir></style></legend>
              1. 本文介绍了在 MySQL 中存储时区偏移的数据类型/结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在 MySQL 中存储时区偏移量的正确数据类型/结构是什么?我只想存储数值(城市和国家显然存储在其他列中).

                Which would be the proper datatype/structure to store timezone offsets in MySQL? I just want to store the numeric value (the city and country are obviously stored in other columns).

                示例:

                • -5:00 瓜亚基尔,ECU
                • -4:30 加拉加斯,威尼斯
                • 0:00 某个城市
                • 2:00 波恩,德国

                推荐答案

                你应该使用 TIME.这是任务的正确数据类型:您有格式和 计算 可用.此外,根据文档, TIME 也应该被用作两个时刻之间差异的结果,这实际上是 Timezones.

                You should use TIME. It's the right data type for the task: you have formatting and calculations are available. Moreover, according to the docs, TIME is also supposed to be used as a result of differences between two moments, which is what Timezones are in fact.

                来自文档:

                MySQL 以HH:MM:SS"格式(或'HHH:MM:SS' 格式用于大小时值).TIME 值的范围可以从-838:59:59"到838:59:59".小时部分可能如此之大,因为TIME 类型不仅可以用来表示一天中的某个时间(它必须少于 24 小时),但也包括经过的时间或时间间隔两个事件之间(可能远大于 24 小时,甚至阴性).

                MySQL retrieves and displays TIME values in 'HH:MM:SS' format (or 'HHH:MM:SS' format for large hours values). TIME values may range from '-838:59:59' to '838:59:59'. The hours part may be so large because the TIME type can be used not only to represent a time of day (which must be less than 24 hours), but also elapsed time or a time interval between two events (which may be much greater than 24 hours, or even negative).

                这篇关于在 MySQL 中存储时区偏移的数据类型/结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何将空值传递给外键字段? 下一篇:强制执行具有完整性约束的“子集"关系的最佳方法是什么

                相关文章

              2. <small id='woNLa'></small><noframes id='woNLa'>

                  <tfoot id='woNLa'></tfoot>

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

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