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

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

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

      如何在 PHP 中获得格林威治标准时间?

      How do I get Greenwich Mean Time in PHP?(如何在 PHP 中获得格林威治标准时间?)

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

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

              • 本文介绍了如何在 PHP 中获得格林威治标准时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个设置为 EST 的服务器,并且数据库中的所有记录都设置为 EST.我想知道如何将其设置为 GMT.我想为我的用户提供时区选项.

                I have a server which is set to EST, and all records in the database are set to EST. I would like to know how to set it to GMT. I want to offer a time zone option to my users.

                推荐答案

                无论服务器在哪个 GMT 时区,这里都有一个非常简单的方法来获取任何时区的时间和日期.这是通过 time()gmdate() 函数完成的.gmdate() 函数通常为我们提供 GMT 时间,但是通过使用 time() 函数我们可以得到 GMT+N 或 GMT-N,这意味着我们可以获取任何 GMT 时区的时间.

                No matter in which GMT time zone the server is, here is an extremely easy way to get time and date for any time zone. This is done with the time() and gmdate() functions. The gmdate() function normally gives us GMT time, but by doing a trick with the time() function we can get GMT+N or GMT-N, meaning we can get the time for any GMT time zone.

                例如,如果你必须得到 GMT+5 的时间,你可以这样做

                For example, if you have to get the time for GMT+5, you can do it as follows

                <?php 
                  $offset=5*60*60; //converting 5 hours to seconds.
                  $dateFormat="d-m-Y H:i";
                  $timeNdate=gmdate($dateFormat, time()+$offset);
                ?>
                

                现在,如果您必须获取 GMT-5 的时间,您可以从 time() 中减去偏移量,而不是添加到偏移量中,如下例中我们获取GMT-4 时间

                Now if you have to get the time for GMT-5, you can just subtract the offset from the time() instead of adding to it, like in the following example where we are getting the time for GMT-4

                <?php 
                  $offset=4*60*60; //converting 4 hours to seconds.
                  $dateFormat="d-m-Y H:i"; //set the date format
                  $timeNdate=gmdate($dateFormat, time()-$offset); //get GMT date - 4
                ?>
                

                这篇关于如何在 PHP 中获得格林威治标准时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 的问题)

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

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

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