Joci93
Joci93

Reputation: 833

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/

Upvotes: 0

Views: 281

Answers (1)

dRwg
dRwg

Reputation: 91

What about .getMinutes() method? =)

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

Upvotes: 3

Related Questions