运行 ❯
获取您自己的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h2>JavaScript Dates</h2> <p>setFullYear() sets the year of a date object:</p> <p id="demo"></p> <script> const d = new Date(); d.setFullYear(2020, 10, 3); document.getElementById("demo").innerHTML = d; </script> <p><strong>Note:</strong> JavaScript counts months from 0 to 11. Month 10 is November.</p> </body> </html>