当前位置:网站首页>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
}边栏推荐
- Golang operation redis: write and read kV data
- SQL implementation merges multiple rows of records into one row
- (翻译)异步编程:Async/Await在ASP.NET中的介绍
- mysql误删root账户导致无法登录
- Heap sort and priority queue
- Yolov1 learning notes
- Asynchronous programming: async/await in asp Net
- Ruoyi interface permission verification
- Integration test practice (1) theoretical basis
- Pytest attempts to execute the test case without skipping, but the case shows that it is all skipped
猜你喜欢

如何迁移或复制VMware虚拟机系统

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

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

卡特兰数(Catalan)的应用场景

Dbnet: real time scene text detection with differentiable binarization

vmware虚拟机C盘扩容

2022 CISP-PTE(三)命令执行

Software testing learning - day one

How to migrate or replicate VMware virtual machine systems

EasyExcel
随机推荐
DBNet:具有可微分二值化的实时场景文本检测
Notes on the core knowledge of Domain Driven Design DDD
Code management tools
[leetcode] day93 - intersection of two arrays II
These two mosquito repellent ingredients are harmful to babies. Families with babies should pay attention to choosing mosquito repellent products
学习笔记 -- k-d tree 和 ikd-Tree 原理及对比
The dynamic analysis and calculation of expressions are really delicious for flee
Learning notes -- principles and comparison of k-d tree and IKD tree
error C2017: 非法的转义序列
Software testing assignment - the next day
Yolov1 learning notes
Operation principle of lua on C: Foundation
[Code] if (list! = null & list. Size() > 0) optimization, set empty judgment implementation method
Application scenarios of Catalan number
C2338 Cannot format an argument. To make type T formattable provide a formatter<T> specialization:
golang操作redis:写入、读取kv数据
Resttemplate configuration use
(翻译)异步编程:Async/Await在ASP.NET中的介绍
Software testing learning - the next day
How can the server set up multiple interfaces and install IIS? Tiantian gives you the answer!