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

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

        <tfoot id='mqLp6'></tfoot>

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

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

        MySQL:保持服务器时区或用户时区?

        MySQL: keep server timezone or user timezone?(MySQL:保持服务器时区或用户时区?)
      1. <small id='Cec1D'></small><noframes id='Cec1D'>

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

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

                  <bdo id='Cec1D'></bdo><ul id='Cec1D'></ul>
                    <tbody id='Cec1D'></tbody>
                  本文介绍了MySQL:保持服务器时区或用户时区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在考虑在我的网站中存储用户登录的日期,但我不知道什么是最合乎逻辑的解决方案.

                  I'm thinking about to store dates on user login in my site, but I don't know what is the most logical solution.

                  最初,我想使用服务器时区,然后使用服务器机器日期和用户机器日期之间的差异操作来管理它,但我也考虑过使用时区和 php 类日期直接更改它,所以:

                  Initially, I though to use server timezone, and then to manage it using difference operations between server machine date and user machine date, but I've also considered to change it direclty using timezone and php class date, so:

                  <?php
                  // my server has for example America/New_York timezone
                  $user_timezone = "Europe/Rome";
                  date_default_timezone_set ($user_timezone);
                  $date = date ('Y-m-d H:i:s');
                  $sql = "UPDATE users SET user_last_modify = '$date', user_timezone = '$user_timezone' WHERE user_id = 'some id' LIMIT 1;";
                  $res = mysql_query ($sql);
                  ?>
                  

                  我的问题是,最好的解决方案是保留服务器时区还是使用用户时区?
                  如果我使用用户时区,我是否也应该像我的示例一样保存时区名称?

                  My ask is, what is the best solution, keep server timezone or use user timezone?
                  and if I use user timezone, should I save the timezone name too as in my example?

                  推荐答案

                  我建议使用服务器时区或 UTC,而不是为每个用户存储不同的数据.这样,您的数据库将完全一致,并且您可以执行一些操作,例如比较,而不必为每个条目获取 user_timezone 列并执行转换(这不是完全免费的)

                  I'd recommend using server timezone or UTC, rather than storing different data for each user. This way, your database will be fully consistent, and you can perform some operations like comparisons without having to, for each entry, fetch the user_timezone column and perform the conversion (which is not fully free)

                  这篇关于MySQL:保持服务器时区或用户时区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <bdo id='Cr4P1'></bdo><ul id='Cr4P1'></ul>
                      <tfoot id='Cr4P1'></tfoot>
                    • <legend id='Cr4P1'><style id='Cr4P1'><dir id='Cr4P1'><q id='Cr4P1'></q></dir></style></legend>

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

                          <tbody id='Cr4P1'></tbody>

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