var oldDate = new Date(2011,4,23,0,0,0)
var nowDate = new Date()
var week = "日,一,二,三,四,五,六".split(',')
var str = "今天是"+nowDate.getFullYear()+"年"+(nowDate.getMonth() + 1)+"月"+nowDate.getDate()+"日 星期"+week[nowDate.getDay()]+" 我们已经认识"+parseInt((nowDate.getTime() - oldDate.getTime())/ 86400000)+"天了"
document.write(str)
</script>
javascript 自带有个对象(构造函数),Date().下面是代码:var myDate = new Date()//实例一个时间对象;
myDate.getFullYear() //获取系统的年;
myDate.getMonth()+1 //获取系统月份,由于月份是从0开始计算,所以要加1
myDate.getDate()// 获取系统日,
myDate.getHours()//获取系统时,
myDate.getMinutes()//分
myDate.getSeconds()//秒