gpt4 book ai didi

javascript - 如何以字母显示日期 - Javascript --> insidehtml?

转载 作者:行者123 更新时间:2023-12-02 21:42:18 26 4
gpt4 key购买 nike

var d = new Date();
var n = d.toLocaleDateString();
document.getElementById("dt").innerHTML = n;
<body>
<p id="dt" style="color: white; position: absolute; right: 25px; top: 5px; font-size: 25px;"></p>
</body>

最佳答案

const options = {
weekday: 'long',
year: 'numeric',
month: 'long',
day: 'numeric'
};

var d = new Date();
var n = d.toLocaleDateString('en-EN', options);
document.getElementById("dt").innerHTML = n;
<p id="dt"></p>

关于javascript - 如何以字母显示日期 - Javascript --> insidehtml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60339786/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com