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

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

        当我直接从 MySQL 获取时,NodeJS 响应 MySQL 时区不同

        时间:2023-06-26

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

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

                • <bdo id='QsWHL'></bdo><ul id='QsWHL'></ul>
                  <tfoot id='QsWHL'></tfoot>
                    <tbody id='QsWHL'></tbody>
                  本文介绍了当我直接从 MySQL 获取时,NodeJS 响应 MySQL 时区不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我直接请求 MySQL 时,我以 UTC 返回日期(我在 MySQL 服务器中设置了 UTC),但是使用 NodeJS 我得到 UTC+2 本地时区数据,为什么?如何设置 NodeJS 以获取 UTC?

                  When I request MySQL directly, I get back date in UTC (I set UTC in MySQL server), but with NodeJS I get UTC+2 local time zone data, why? How can I set NodeJS to get UTC?

                  推荐答案

                  我在index.js初始化mysql连接时添加了timezone

                  I have added timezone in index.js when initializing mysql connection

                  var db_config = {
                    host     : 'localhost',
                    user     : 'xxx',
                    password : '',
                    database : 'xxx',
                    timezone: 'utc'  //<-here this line was missing
                  };
                  

                  这篇关于当我直接从 MySQL 获取时,NodeJS 响应 MySQL 时区不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:WHERE 日期时间早于某个时间(例如 15 分钟) 下一篇:MySQL concat() 创建要在查询中使用的列名?

                  相关文章

                • <legend id='yByCR'><style id='yByCR'><dir id='yByCR'><q id='yByCR'></q></dir></style></legend>
                  1. <small id='yByCR'></small><noframes id='yByCR'>

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