我想给localstorage设置一个时间戳。我设置的时间戳应该从当前时间中减去。我想做的是倒计时
funcion setLocalStorage(){
localStorage.setItem("countDown", new Date().toString());
}
funcion getLocalStorage(){
return localStorage.getItem("countDown");
}
let diff = new Date() - getLocalStorage()
2条答案
按热度按时间dzhpxtsq1#
第一个月
那么
let diff = new Date().getTime() - Number(getLocalStorage())
watbbzwu2#