W3School TIY Editor
W3School 在线教程
改变方向
暗黑模式
运行代码
<!DOCTYPE html> <html> <body> <h1>日期字符串化</h1> <p>JSON.stringify 将日期转换为字符串</p> <p id="demo"></p> <script> const person = { name: "Bill", today: new Date() }; let myString = JSON.stringify(person); document.getElementById("demo").innerHTML = myString; </script> </body> </html>