Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/437.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 从“转换”;yyyy MM ddThh:MM:ss“;在Google Chrome和IE中显示不同结果 日期时间问题 var dateInOtherFormat=“2017-02-02T13:00:00”; var localDate=新日期(dateInOtherFormat); document.body.innerHTML=localDate;_Javascript_Html_Date_Datetime - Fatal编程技术网

Javascript 从“转换”;yyyy MM ddThh:MM:ss“;在Google Chrome和IE中显示不同结果 日期时间问题 var dateInOtherFormat=“2017-02-02T13:00:00”; var localDate=新日期(dateInOtherFormat); document.body.innerHTML=localDate;

Javascript 从“转换”;yyyy MM ddThh:MM:ss“;在Google Chrome和IE中显示不同结果 日期时间问题 var dateInOtherFormat=“2017-02-02T13:00:00”; var localDate=新日期(dateInOtherFormat); document.body.innerHTML=localDate;,javascript,html,date,datetime,Javascript,Html,Date,Datetime,从“yyyy-MM-ddThh:MM:ss”格式转换为本地时间,在不同的浏览器中显示不同的结果。您可以编写一种方法来检查浏览器是什么。然后到不同的浏览器使用不同的代码。在Chrome:2017-02-02T13:00:00.000Z,IE:2017-02-02T07:30:00.000Z中使用localDate.toISOString()。。。。。。。。。我的时区是+05:30。在chrome中,它将提前5:30小时。ToLocalString()?@SanjayPatel chrome:201

从“yyyy-MM-ddThh:MM:ss”格式转换为本地时间,在不同的浏览器中显示不同的结果。

您可以编写一种方法来检查浏览器是什么。然后到不同的浏览器使用不同的代码。

在Chrome:2017-02-02T13:00:00.000Z,IE:2017-02-02T07:30:00.000Z中使用localDate.toISOString()。。。。。。。。。我的时区是+05:30。在chrome中,它将提前5:30小时。ToLocalString()?@SanjayPatel chrome:2017年2月2日,下午6:30:00 IE:‎2.‎/‎2.‎/‎2017‎ ‎13‎:‎00‎:‎00<代码>新日期(dateInOtherFormat+“Z”)
 <!DOCTYPE html>
 <html>
 <head>
    <title>Date Time Issue</title> </head> <body>
    <script>
       var dateInOtherFormat = "2017-02-02T13:00:00";
       var localDate = new Date(dateInOtherFormat);
       document.body.innerHTML = localDate;
    </script>
 </body>
 </html>