$(document).ready(function(){
var setPc =setInterval(function () {
var date = new Date();
var nowDate = ""+date.getFullYear()+(date.getMonth()+1)+date.getDate()+date.getHours()+date.getMinutes()+date.getSeconds();
console.log(nowDate);
if (nowDate>"2020528235959"){ //将你要设定的时间去掉间隔与获取的时间做对比
$("#img").css("display","block");
clearInterval(setPc)
}
},1000,setPc)
})
//第二种
$(document).ready(function(){
var date = new Date();
var seperator1 = "/";
var seperator2 = ":";
var year = date.getFullYear();
var month = date.getMonth() + 1;
var strDate = date.getDate();
var hour= date.getHours(); //获取当前小时数(0-23)
var minut=date.getMinutes(); //获取当前分钟数(0-59)
var second=date.getSeconds();
var date1_s = year + seperator1 + month + seperator1 + strDate+" "+ hour + seperator2+ minut+ seperator2+ second; //获取当前日期时间
var date2_s = "2020/09/01 00:00:00"
var date1_unix = Date.parse(date1_s);
var date2_unix = Date.parse(date2_s);
if ( date1_unix>date2_unix) {
$('#abc1').remove();
}
});
版权声明:本文为JKING_原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。