当前位置:网站首页>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
}边栏推荐
- pytorch练习小项目
- 100000 bonus is divided up. Come and meet the "sister who braves the wind and waves" among the winners
- 保险公司怎么查高血压?
- 修改MySQL密码
- The pressure of large institutions in the bear market has doubled. Will the giant whales such as gray scale, tether and micro strategy become 'giant thunder'?
- Golang operation redis: write and read kV data
- HMS core helps baby bus show high-quality children's digital content to global developers
- Pytest attempts to execute the test case without skipping, but the case shows that it is all skipped
- 2022 cisp-pte (III) command execution
- Chapter 8. MapReduce production experience
猜你喜欢

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

论文笔记 VSALM 文献综述《A Comprehensive Survey of Visual SLAM Algorithms》

10000小时定律不会让你成为编程大师,但至少是个好的起点

Golang operation redis: write and read hash type data

MySQL installation

Yolov2 learning and summary

Integration test practice (1) theoretical basis

La loi des 10 000 heures ne fait pas de vous un maître de programmation, mais au moins un bon point de départ

2022 East China Normal University postgraduate entrance examination machine test questions - detailed solution

HMS core helps baby bus show high-quality children's digital content to global developers
随机推荐
Realize PDF to picture conversion with C #
【code】偶尔取值、判空、查表、验证等
Golang operation redis: write and read hash type data
The list of "I'm crazy about open source" was released in the first week, with 160 developers on the list
The pressure of large institutions in the bear market has doubled. Will the giant whales such as gray scale, tether and micro strategy become 'giant thunder'?
简易密码锁
My 2020 summary "don't love the past, indulge in moving forward"
La loi des 10 000 heures ne fait pas de vous un maître de programmation, mais au moins un bon point de départ
Stream stream
Integration test practice (1) theoretical basis
Laravel框架 踩坑(一)
Simple password lock
Interface test weather API
The difference between CONDA and pip
【类和对象】深入浅出类和对象
第8章、MapReduce 生产经验
mysql误删root账户导致无法登录
多个全局异常处理类,怎么规定执行顺序
[LeetCode]404. 左叶子之和
Pytest attempts to execute the test case without skipping, but the case shows that it is all skipped