js獲取當前時間的前一天

 

 

    其實這種需求很多很多,今天記錄下來把:

 

function getPrevDate() {
   return new Date(new Date() - 1000*60*60*24).getDate();
}

 

function getPrevMonth() {
    return  new Date(new Date() - 1000*60*60*24).getMonth() + 1;
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章