当前位置:网站首页>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
}边栏推荐
- 远端rostopic的本地rviz调用及显示
- 利用C#实现Pdf转图片
- Practical plug-ins in idea
- opencv鼠标键盘事件
- [untitled]
- DNS forward query:
- 2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)
- 【类和对象】深入浅出类和对象
- crontab定时任务
- These two mosquito repellent ingredients are harmful to babies. Families with babies should pay attention to choosing mosquito repellent products
猜你喜欢

The dynamic analysis and calculation of expressions are really delicious for flee

golang操作redis:写入、读取kv数据

Pytest -- write and manage test cases

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

2022年华东师范大学计科考研复试机试题-详细题解

Software testing assignment - day 1

The list of "I'm crazy about open source" was released in the first week, with 160 developers on the list

多个全局异常处理类,怎么规定执行顺序

SSH link remote server and local display of remote graphical interface
![[untitled]](/img/72/4ff9354634342580a135debb58b60e.jpg)
[untitled]
随机推荐
10000小時定律不會讓你成為編程大師,但至少是個好的起點
UTC时间、GMT时间、CST时间
EasyExcel
opencv
10000小时定律不会让你成为编程大师,但至少是个好的起点
Heap sort and priority queue
Integration test practice (1) theoretical basis
My 2020 summary "don't love the past, indulge in moving forward"
Software testing assignment - the next day
php artisan
New knowledge! The virtual machine network card causes your DNS resolution to slow down
[leetcode] day93 - intersection of two arrays II
Local rviz call and display of remote rostopic
vmware虚拟机C盘扩容
SQL implementation merges multiple rows of records into one row
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
Simple password lock
【无标题】
多个全局异常处理类,怎么规定执行顺序
2021 year end summary