Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

Date.toLocaleDateString returns wrong date format

$
0
0

Please try the following code:

<!DOCTYPE html><html><body><p>Click the button to display the date as a string.</p><button onclick="myFunction()">Try it</button><p id="demo"></p><script>
function myFunction() {
    var d = new Date();
    var n = d.toLocaleDateString("zh-cn", {year:"numeric", month:"long"});
    document.getElementById("demo").innerHTML = n;
}</script></body></html>

Expected Result:‎

2014‎年‎11月‎


Actual Result: ‎

2014‎年‎11月‎月


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>