用于大屏显示日期为(2024年09月03日 星期二)时间格式

html

html 复制代码
<span id="date"></span>

js

复制代码
$(function () {
        // 更新日期
        $('#date').text(getCurrentDate());
})

function getCurrentDate() {
    const today = new Date();
    const year = today.getFullYear();
    const month = ('0' + (today.getMonth() + 1)).slice(-2); // 月份从0开始,所以加1
    const day = ('0' + today.getDate()).slice(-2);
    const weekday = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'][today.getDay()];
    return `${year}年${month}月${day}日 ${weekday}`;
}
相关推荐
NiceCloud喜云36 分钟前
Opus 4.8 的 Effort Control 怎么选:Low 到 Max 五档策略
android·java·大数据·前端·c++·python·spring
wordbaby1 小时前
React Native + RNOH:跨页面数据回传的最佳实践与避坑指南
前端·react native
GISer_Jing1 小时前
Three.js着色器编译机制深度解析
javascript·webgl·着色器
丷丩1 小时前
MapLibre GL JS第22课:查看本地GeoJSON
前端·javascript·map·mapbox·maplibre gl js
AI玫瑰助手1 小时前
Python函数:默认参数的定义与注意事项
开发语言·python·信息可视化
油炸自行车1 小时前
Claude Code 错误:API Error: 400 Failed to deserialize the JSON body into the
开发语言·javascript·json·trae·claude code·api error 400
肩上风骋1 小时前
C++14特性
开发语言·c++·c++14特性
Front思2 小时前
AI前端工程师需要具备能力+
前端·人工智能·ai
JAVA社区3 小时前
Java高级全套教程(十)—— SpringCloudAlibaba超详细实战详解
java·开发语言·spring cloud·面试·职场和发展
弥树子3 小时前
踩坑记录:服务器内网调用接口,真实请求URL与官方公开URL不一致问题排查
开发语言·php