<script>
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("星期天","星期一","星期二","星期三","星期四","星期五","星期六")
var montharray=new Array("1","2","3","4","5","6","7","8","9","10","11","12")
document.write("今天是"+year+"年"+montharray[month]+"月"+daym+"日"+","+dayarray[day])
</script>
显示效果如下: