当前位置:网站首页>JS date comparison
JS date comparison
2022-07-03 06:53:00 【God】
if(nowDate() > date){
// yesterday
$("#yesterday").html(htmlStr);
}else if (nowDate() < date){
// Tomorrow,
$("#tomorrow").html(htmlStr);
}else {
// today
$("#today").html(htmlStr);
}// Today's date
function nowDate(){
let now = new Date();
let year = now.getFullYear();
let month = now.getMonth() + 1;
let day = now.getDate();
if(month < 10){
month = '0'+month;
}
if(day < 10){
day = '0'+day;
}
let nowStr = year +"-"+ month+"-"+day;
return nowStr
}边栏推荐
- Ruoyi interface permission verification
- What are the characteristics and functions of the scientific thinking mode of mechanical view and system view
- Software testing learning - the next day
- Scroll view specifies the starting position of the scrolling element
- UNI-APP中条件注释 实现跨段兼容、导航跳转 和 传参、组件创建使用和生命周期函数
- Software testing learning - day 3
- 10000小时定律不会让你成为编程大师,但至少是个好的起点
- Liang Ning: 30 lectures on brain map notes for growth thinking
- 爬虫代码基础教学
- My 2020 summary "don't love the past, indulge in moving forward"
猜你喜欢

Practical plug-ins in idea

Ruoyi interface permission verification

Yolov3 learning notes

Application scenarios of Catalan number

Chapter 8. MapReduce production experience

远端rostopic的本地rviz调用及显示

10万奖金被瓜分,快来认识这位上榜者里的“乘风破浪的姐姐”

数值法求解最优控制问题(一)——梯度法

Numerical method for solving optimal control problem (I) -- gradient method

利用C#实现Pdf转图片
随机推荐
Jenkins
How matlab modifies default settings
Asynchronous programming: async/await in asp Net
Operation principle of lua on C: Foundation
Architecture notes
MATLAB如何修改默认设置
Liang Ning: 30 lectures on brain map notes for growth thinking
Pytest -- write and manage test cases
Modify MySQL password
[untitled] 5 self use history
Redis command
【code】if (list != null && list.size() > 0)优化,集合判空实现方式
[open source project recommendation colugomum] this group of undergraduates open source retail industry solutions based on the domestic deep learning framework paddlepadddle
100000 bonus is divided up. Come and meet the "sister who braves the wind and waves" among the winners
2022年华东师范大学计科考研复试机试题-详细题解
Application scenarios of Catalan number
修改MySQL密码
The difference between CONDA and pip
Laravel框架 踩坑(一)
The list of "I'm crazy about open source" was released in the first week, with 160 developers on the list