Javascript Date toMyDateString()
Date.prototype.toMyDateString=function(){ var year=this.getFullYear(); var month=this.getMonth(); var date=this.getDate(); return year+"-"+month+"-"+date; } String.prototype.dateStringToDate=function(text){ console.log(this);/* ww w . ja v a 2s. co m*/ } var s="I am fudongdong"; s.dateStringToDate(); var d=new Date(); console.log(d.toMyDateString());