用于大屏显示日期为(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}`;
}
相关推荐
小小测试开发6 小时前
安装 Python 3.10+
开发语言·人工智能·python
KaMeidebaby7 小时前
卡梅德生物技术快报|PD1 单克隆抗体定制配套 N 糖全谱质控开发
前端·人工智能·算法·数据挖掘·数据分析
nuIl8 小时前
实现一个 Coding Agent(3):工具调用
前端·agent·cursor
nuIl8 小时前
实现一个 Coding Agent(4):ReAct 循环
前端·agent·cursor
AAA大运重卡何师傅(专跑国道)8 小时前
【无标题】
开发语言·c#
nuIl8 小时前
实现一个 Coding Agent(1):一次 LLM 调用
前端·agent·cursor
nuIl8 小时前
实现一个 Coding Agent(2):让 LLM 流式响应
前端·agent·cursor
copyer_xyf8 小时前
Python 异常处理
前端·后端·python
sugar__salt8 小时前
从栈队列数据结构到JS原型面向对象全解
前端·javascript·数据结构
XBodhi.8 小时前
Visual Studio C++ 语法错误: 缺少“;”(在“return”的前面)
开发语言·c++·visual studio