js acquisition date, acquisition today, yesterday, three days or seven days before the date function

        FunGetDateStr: function (P_Count) {
             var dd = new new a Date (); 
            dd.setDate (dd.getDate () + P_Count); // get the date P_Count days 
            var Y = dd.getFullYear ();
             var m = dd.getMonth () + 1; // get the date of the current month 
            IF (m <10 ) { 
                m = '0' + m; 
            } 
            var D = dd.getDate ();
             IF (D <10 ) { 
                D = '0' + D; 
            } 
            return Y + "-" + m + "-" + d;
        }

 var three = dates.FunGetDateStr(-3);
            $("#starttime").val(three);

Get to three days before the date

Guess you like

Origin www.cnblogs.com/webmc/p/11996734.html