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

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

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

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

      通过回显将日期时间/时间戳从 PHP 传递到 Javascript

      Pass Datetime/Timestamp from PHP to Javascript by echo(通过回显将日期时间/时间戳从 PHP 传递到 Javascript)
          <tfoot id='uIDQ2'></tfoot>
        • <legend id='uIDQ2'><style id='uIDQ2'><dir id='uIDQ2'><q id='uIDQ2'></q></dir></style></legend>

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

            • <bdo id='uIDQ2'></bdo><ul id='uIDQ2'></ul>
                <tbody id='uIDQ2'></tbody>
            • <i id='uIDQ2'><tr id='uIDQ2'><dt id='uIDQ2'><q id='uIDQ2'><span id='uIDQ2'><b id='uIDQ2'><form id='uIDQ2'><ins id='uIDQ2'></ins><ul id='uIDQ2'></ul><sub id='uIDQ2'></sub></form><legend id='uIDQ2'></legend><bdo id='uIDQ2'><pre id='uIDQ2'><center id='uIDQ2'></center></pre></bdo></b><th id='uIDQ2'></th></span></q></dt></tr></i><div id='uIDQ2'><tfoot id='uIDQ2'></tfoot><dl id='uIDQ2'><fieldset id='uIDQ2'></fieldset></dl></div>
              • 本文介绍了通过回显将日期时间/时间戳从 PHP 传递到 Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何将日期时间/时间戳从 PHP 传递到 javascript.以下似乎不起作用:

                How can I pass a datetime/timestamp from PHP to javascript. The following does not appear to work:

                startLive = new Date(<?php echo date("U", strtotime($start_date)); ?>); 
                

                推荐答案

                试试这个:

                startLive = new Date(<?php echo strtotime($start_date)*1000; ?>);
                

                解释:

                PHP 的 strtotime 函数返回一个 Unix 时间戳(从 1-1-1970 年午夜).

                PHP's strtotime function returns a Unix timestamp (seconds since 1-1-1970 at midnight).

                Javascript的Date()函数可以通过指定毫秒来实例化 自 1970 年 1 月 1 日午夜开始.

                Javascript's Date() function can be instantiated by specifying milliseconds since 1-1-1970 at midnight.

                所以将秒数乘以 1000 得到毫秒数,可以在 Javascript 中使用.

                So multiply seconds by 1000 and you get milliseconds, which you can use in Javascript.

                这篇关于通过回显将日期时间/时间戳从 PHP 传递到 Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 的问题)
                    <bdo id='yTLTV'></bdo><ul id='yTLTV'></ul>

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

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

                        <tfoot id='yTLTV'></tfoot>
                        <legend id='yTLTV'><style id='yTLTV'><dir id='yTLTV'><q id='yTLTV'></q></dir></style></legend>
                          <tbody id='yTLTV'></tbody>