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

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

      2. <legend id='Kzx93'><style id='Kzx93'><dir id='Kzx93'><q id='Kzx93'></q></dir></style></legend>

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

      3. PHP - strtotime,指定时区

        PHP - strtotime, specify timezone(PHP - strtotime,指定时区)
          <tfoot id='6FKIR'></tfoot>
          <legend id='6FKIR'><style id='6FKIR'><dir id='6FKIR'><q id='6FKIR'></q></dir></style></legend>

              <bdo id='6FKIR'></bdo><ul id='6FKIR'></ul>

                    <tbody id='6FKIR'></tbody>

                  <small id='6FKIR'></small><noframes id='6FKIR'>

                1. <i id='6FKIR'><tr id='6FKIR'><dt id='6FKIR'><q id='6FKIR'><span id='6FKIR'><b id='6FKIR'><form id='6FKIR'><ins id='6FKIR'></ins><ul id='6FKIR'></ul><sub id='6FKIR'></sub></form><legend id='6FKIR'></legend><bdo id='6FKIR'><pre id='6FKIR'><center id='6FKIR'></center></pre></bdo></b><th id='6FKIR'></th></span></q></dt></tr></i><div id='6FKIR'><tfoot id='6FKIR'></tfoot><dl id='6FKIR'><fieldset id='6FKIR'></fieldset></dl></div>
                2. 本文介绍了PHP - strtotime,指定时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个日期字符串,比如2008-09-11".我想从中获得一个时间戳,但我需要动态指定一个时区(而不是 PHP 默认).

                  I have a date string, say '2008-09-11'. I want to get a timestamp out of this, but I need to specify a timezone dynamically (rather then PHP default).

                  回顾一下,我有两个字符串:

                  So to recap, I have two strings:

                  $dateStr = '2008-09-11';
                  $timezone = 'Americas/New_York';
                  

                  我如何获得这个时间戳?

                  How do I get the timestamp for this?

                  一天中的时间将是当天的午夜.... $dateStr = '2008-09-11 00:00:00';

                  The time of day will be the midnight of that day.... $dateStr = '2008-09-11 00:00:00';

                  推荐答案

                  $date = new DateTime($dateStr, new DateTimeZone($timezone));
                  

                  $timestamp = $date->format('U');

                  这篇关于PHP - strtotime,指定时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Converting between timezones in PHP(在 PHP 中的时区之间转换)
                  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(更新时区信息)?)
                  How to convert between time zones in PHP using the DateTime class?(如何使用 DateTime 类在 PHP 中的时区之间进行转换?)
                  • <small id='OFdxh'></small><noframes id='OFdxh'>

                      <tbody id='OFdxh'></tbody>
                    1. <tfoot id='OFdxh'></tfoot>
                        <legend id='OFdxh'><style id='OFdxh'><dir id='OFdxh'><q id='OFdxh'></q></dir></style></legend>

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

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