<body>
<input id="t1"/>
<input id="t2"/>
<script>
Date.prototype.toBeginTime = function(){
return this.getFullYear() + "-" + parseInt(this.getMonth()+1) + "-" + this.getDate() + " " + "00:00:00";
}
Date.prototype.toEndTime = function(){
return this.getFullYear() + "-" + parseInt(this.getMonth()+1) + "-" + this.getDate() + " " + "23:59:59";
}
document.all.t1.value = new Date().toBeginTime();
document.all.t2.value = new Date().toEndTime();
</script>
</body>