熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

如何使用Javascript獲取距今n天前的日期

2022-06-13   來源: JSP教程 
本篇文章是對使用Javascript獲取距今n天前日期的實現代碼進行了詳細的分析介紹需要的朋友參考下   復制代碼 代碼如下:

  
 function Test(day) {
                var today = new Date();
                var beforMilliseconds = todaygetTime() * * * day;
                var beforday = new Date();
                befordaysetTime(beforMilliseconds);
                var strYear = befordaygetFullYear();
                var strDay = befordaygetDate();
                var strMonth = befordaygetMonth() + ;
                if (strMonth < ) {
                    strMonth = "" + strMonth;
                }
                var strYesterday = strYear + "" + strMonth + "" + strDay;
                alert(strYesterday);
            }


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20584.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.