1. <legend id='nQAoQ'><style id='nQAoQ'><dir id='nQAoQ'><q id='nQAoQ'></q></dir></style></legend>

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

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

    3. <tfoot id='nQAoQ'></tfoot>

      php将日期时间转换为UTC

      php convert datetime to UTC(php将日期时间转换为UTC)

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

                本文介绍了php将日期时间转换为UTC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我需要一种简单的方法来将日期时间戳转换为 UTC(从服务器所在的任何时区),希望不使用任何库.

                I am in need of an easy way to convert a date time stamp to UTC (from whatever timezone the server is in) HOPEFULLY without using any libraries.

                推荐答案

                试试 getTimezone 和 setTimezone,见例子

                (但这确实使用了一个类)

                (But this does use a Class)

                更新:

                没有任何课程,你可以尝试这样的事情:

                Without any classes you could try something like this:

                $the_date = strtotime("2010-01-19 00:00:00");
                echo(date_default_timezone_get() . "<br />");
                echo(date("Y-d-mTG:i:sz",$the_date) . "<br />");
                echo(date_default_timezone_set("UTC") . "<br />");
                echo(date("Y-d-mTG:i:sz", $the_date) . "<br />");
                

                注意:您可能还需要将时区设置回原始时区

                NOTE: You might need to set the timezone back to the original as well

                这篇关于php将日期时间转换为UTC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Converting between timezones in PHP(在 PHP 中的时区之间转换)
                PHP - strtotime, specify timezone(PHP - strtotime,指定时区)
                Get current date, given a timezone in PHP?(获取当前日期,给定 PHP 中的时区?)
                List of US Time Zones for PHP to use?(PHP 使用的美国时区列表?)
                How to detect Ambiguous and Invalid DateTime in PHP?(如何在 PHP 中检测不明确和无效的 DateTime?)
                How to update timezonedb in PHP (updating timezones info)?(如何在 PHP 中更新 timezonedb(更新时区信息)?)

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

                    <legend id='XoY0C'><style id='XoY0C'><dir id='XoY0C'><q id='XoY0C'></q></dir></style></legend>
                      <bdo id='XoY0C'></bdo><ul id='XoY0C'></ul>
                        <tfoot id='XoY0C'></tfoot>
                          <tbody id='XoY0C'></tbody>