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

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

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

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

  1. <tfoot id='whDRR'></tfoot>

    1. 将此字符串转换为时间戳 PHP

      时间:2024-04-13
          <tbody id='E7GY0'></tbody>

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

        <legend id='E7GY0'><style id='E7GY0'><dir id='E7GY0'><q id='E7GY0'></q></dir></style></legend>
        1. <i id='E7GY0'><tr id='E7GY0'><dt id='E7GY0'><q id='E7GY0'><span id='E7GY0'><b id='E7GY0'><form id='E7GY0'><ins id='E7GY0'></ins><ul id='E7GY0'></ul><sub id='E7GY0'></sub></form><legend id='E7GY0'></legend><bdo id='E7GY0'><pre id='E7GY0'><center id='E7GY0'></center></pre></bdo></b><th id='E7GY0'></th></span></q></dt></tr></i><div id='E7GY0'><tfoot id='E7GY0'></tfoot><dl id='E7GY0'><fieldset id='E7GY0'></fieldset></dl></div>
            <bdo id='E7GY0'></bdo><ul id='E7GY0'></ul>
              <tfoot id='E7GY0'></tfoot>
              • 本文介绍了将此字符串转换为时间戳 PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有这个字符串:13/10 15:00",我想将它转换为时间戳,但是当我这样做时:

                I have this string: "13/10 15:00" and I would like to convert it to timestamp but when I do this:

                      $timestamp = strtotime("13/10 15:00");
                

                它返回一个空值.

                推荐答案

                在您的代码中 strtotime() 正在尝试将 13/10 转换为第 10 天第 13 个月,返回错误.

                In your code strtotime() is attempting to convert 13/10 as the tenth day of the 13th month, which returns an error.

                如果要解析自定义格式的日期字符串,最好使用 DateTime::createFromFormat() 代替:

                If you want to parse a date string with a custom format, it's better to use DateTime::createFromFormat() instead:

                $dtime = DateTime::createFromFormat("d/m G:i", "13/10 15:00");
                $timestamp = $dtime->getTimestamp();
                

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

                上一篇:从日期减去一定数量的小时、天、月或年 下一篇:UNIX时间戳总是在格林威治标准时间?

                相关文章

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

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

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

                    <tfoot id='XLyYG'></tfoot>