简体   繁体   中英

JavaScript: toLocaleTimeString() is different in Explorer And Chrome

I found something strange in Explorer 11. Here is the code:

var d = new Date().toLocaleTimeString('en-US', { minute: "numeric"});
console.log(d);

Explorer 11 console: ‎6‎/‎14‎/‎2016‎ ‎2‎:‎27‎:‎15‎ ‎PM

Chrome console: 27

How can I get only the current minute with toLocalTimestring function in Explorer 11?

https://jsfiddle.net/34jd1zap/

What about .getMinutes() method? =)

var minutes = (new Date()).getMinutes();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM