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

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

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

        • <bdo id='Itwe4'></bdo><ul id='Itwe4'></ul>
        <tfoot id='Itwe4'></tfoot>

        在 PHP 中的时区之间转换

        Converting between timezones in PHP(在 PHP 中的时区之间转换)

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

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

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

                  <bdo id='FGRqH'></bdo><ul id='FGRqH'></ul>

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

                  问题描述

                  我正在转换这个时间和日期:

                  I am converting this time and date:

                  Thu, 31 Mar 2011 02:05:59 GMT
                  

                  转为以下时间日期格式:

                  To the following time and date format:

                  Monday March 28 2011 4:48:02 PM
                  

                  我正在使用以下 PHP 代码来完成此操作,但我想将所有时区转换为 PST/PDT.我查看了 PHP 手册并看到了这个 date_default_timezone_set() 但我不确定如何在下面的代码中实现它.

                  I am using the following PHP code to accomplish this, but I want to convert all time zones to PST/PDT. I looked at the PHP manual and saw this date_default_timezone_set() but I am not sure how to implement that into the code I have below.

                  $date = $messages[0]->CreationTime;
                  echo date('l F j Y g:i:s A I', strtotime($date))
                  

                  推荐答案

                  我不会将 date_default_timezone_set 用于一般的 TZ 转换.(澄清一下......如果这是出于显示目的,脚本范围,那么使用默认时区是合理的做法.)

                  I would not use date_default_timezone_set for general TZ conversions. (To clarify... if this is for display purposes, script wide, then using the default timezone is a reasonable thing to do.)

                  相反,我会使用类似的东西:

                  Instead, I would use something like:

                  $tz = new DateTimeZone('America/Los_Angeles');
                  
                  $date = new DateTime('Thu, 31 Mar 2011 02:05:59 GMT');
                  $date->setTimezone($tz);
                  echo $date->format('l F j Y g:i:s A I')."
                  ";
                  

                  这篇关于在 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='mVV9q'></small><noframes id='mVV9q'>

                      <tfoot id='mVV9q'></tfoot>

                          • <bdo id='mVV9q'></bdo><ul id='mVV9q'></ul>
                            <legend id='mVV9q'><style id='mVV9q'><dir id='mVV9q'><q id='mVV9q'></q></dir></style></legend>

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