Skip to content
Fun33 edited this page May 21, 2018 · 2 revisions
    Date.prototype.yyyymmdd = function () {
            var mm = this.getMonth() + 1; // getMonth() is zero-based
            var dd = this.getDate();

            return [this.getFullYear(),
                    (mm > 9 ? '' : '0') + mm,
                    (dd > 9 ? '' : '0') + dd
            ].join('');
        };
        Date.prototype.addDays = function (d) {
            this.setDate(this.getDate() + d);
            return this;
        };
          
        var sdate =   new Date().addDays(-14).yyyymmdd();
        var edate =   new Date().yyyymmdd();
          
        var isPostBack = "<%Response.Write(Page.IsPostBack);%>"; 
   
        if(isPostBack=="False") 
		{        
			document.getElementById("txtDTS").value = sdate;
			document.getElementById("txtDTE").value = edate;
        }
        </script>

Clone this wiki locally