javascript自定义日期格式化

 1 <script>
 2     Date.prototype.formateDate=function(){
 3         var str="";
 4         str+=this.getFullYear()+"年";
 5         str+=(this.getMonth()+1)+"月";
 6         str+=this.getDate()+"日";
 7         return str;
 8     }
 9     var date=new Date();
10     alert(date.formateDate());
11 </script>
原文地址:https://www.cnblogs.com/fengzikuange/p/6381008.html