87,910
社区成员
发帖
与我相关
我的任务
分享
<script language="javascript" type="text/javascript">
var date = new Date();
alert(date.toLocaleDateString());
</script>
<script language="javascript">
//补0函数
function appendZero(s){
return ("00"+ s).substr((s+"").length);
}
var d = new Date();
alert(d.getFullYear() +"-" +appendZero(d.getMonth() +1) + "-" + appendZero(d.getDate()));
</script>
<script>
function Date.prototype.toString(){
var tempMonth=this.getMonth()+1;
tempMonth=(tempMonth.toString().length==1)?("0"+tempMonth):tempMonth;
var tempDate=this.getDate();
tempDate=(tempDate.toString().length==1)?("0"+tempDate):tempDate;
return this.getFullYear()+"年"+tempMonth+"月"+tempDate+"日";
}
alert(new Date())
</script>