執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題,深色/淺色
轉到 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>